Fix instrumentation hook awaiting for middleware with adapters#95357
Merged
Conversation
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Contributor
Tests PassedCommit: aba87c6 |
Contributor
Stats cancelledCommit: aba87c6 |
dab1e59 to
cba4ebf
Compare
76297f9 to
71c5a36
Compare
71c5a36 to
b516fd8
Compare
b516fd8 to
7f5b4c2
Compare
4f31060 to
3a82587
Compare
timneutkens
approved these changes
Jul 6, 2026
Base automatically changed from
mischnic/webpack-tempalte-require-rerwite
to
canary
July 6, 2026 10:01
7f5b4c2 to
aba87c6
Compare
mischnic
added a commit
that referenced
this pull request
Jul 6, 2026
Node.js Middleware was inheriting the wrong parent span (and behaved differently compared to Edge runtime Middleware) `Middleware.execute` and `BaseServer.handleRequest` should be sibling spans (depending on context, both are root spans). Previously `BaseServer.handleRequest` had a child span `Middleware.execute` Depends on #95357 to make the direct entrypoint test pass
mischnic
added a commit
that referenced
this pull request
Jul 7, 2026
Fixup for #95357 `.handler()` is used by adapters but `.default()` (=`internalHandler`) is the legacy entrypoint and used by the non-adapter setup Also needs vercel/vercel#16944
chargome
added a commit
to getsentry/sentry-javascript
that referenced
this pull request
Jul 7, 2026
#22013) 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
This was referenced Jul 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

#94306 fixes this for pages, but middleware was still broken when deployed via adapters
Coming from getsentry/sentry-javascript#21713
Now the instrumentation test suite takes 11m to run in deployment mode though....