Skip to content

fix(nextjs): Handle Middleware.execute root spans on Node.js runtime#22013

Merged
chargome merged 1 commit into
developfrom
cg/nextjs-proxy-instrument
Jul 7, 2026
Merged

fix(nextjs): Handle Middleware.execute root spans on Node.js runtime#22013
chargome merged 1 commit into
developfrom
cg/nextjs-proxy-instrument

Conversation

@chargome

@chargome chargome commented Jul 7, 2026

Copy link
Copy Markdown
Member

Middleware spans on node (middelware/proxy) now run in a detached otel context making Middleware.execute become root spans.

We basically now mirror what we did in edge before by also calling enhanceMiddlewareRootSpan on node. Additionally we had to fork isolation scopes on span start for these spans as these would scope leak otherwise.

ref vercel/next.js#95357
closes #22001
closes #22002

@chargome chargome self-assigned this Jul 7, 2026
@chargome

chargome commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 260bd40. Configure here.

@chargome chargome marked this pull request as ready for review July 7, 2026 11:26
@chargome chargome requested a review from a team as a code owner July 7, 2026 11:26
@chargome chargome requested review from JPeer264, logaretm, mydea, nicohrubec and s1gr1d and removed request for a team and mydea July 7, 2026 11:26
@chargome chargome merged commit 39d05cd into develop Jul 7, 2026
86 checks passed
@chargome chargome deleted the cg/nextjs-proxy-instrument branch July 7, 2026 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nextjs-16 (canary-webpack) Test Failed nextjs-16 (canary) Test Failed

2 participants