Repository navigation
fix(v10/server-utils): End Express layer spans when the client aborts - #25256
Merged
Merged
Conversation
Contributor
size-limit report 📦
|
chargome
marked this pull request as ready for review
October 12, 2026 09:09
chargome
requested review from
isaacs and
mydea
and removed request for
a team
October 12, 2026 09:09
chargome
approved these changes
Oct 12, 2026
chargome
requested review from
andreiborza
and removed request for
isaacs and
mydea
October 12, 2026 09:09
andreiborza
approved these changes
Oct 12, 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.
Backport of: #25209
Differences to the original PR
packages/server-utils/src/integrations/tracing-channel/express/{instrumentation,types}.ts: The original changespackages/server-utils/src/integrations/express/. On v10 that code is atintegrations/tracing-channel/express/and is only used by the orchestrion path. The fix is the same. The only other changes are the imports (v10 doesn't importhasSpanStreamingEnabledand the span name fallbacks) and the code comment, which now names v10'sasyncEnd/beforeSpanEndflow.packages/core/src/integrations/express/patch-layer.ts(new, not in the original): v10's default Express instrumentation is stillpatchExpressModulein@sentry/core. That code was removed fromdevelop, and it has the samefinish-only bug (the reporter in Express request-handler span never ends when the client aborts, dropping its subtree from the http.server transaction #25183 hit it on 10.55.0). This adds the sameclosehandling: the layer span ends onclose, gets statuscancelled, and both listeners are removed when the span ends viafinish,close, ornext(). Without this, default v10 users wouldn't get the fix.dev-packages/node-integration-tests/suites/express/client-abort/test.ts: The test now checks the statictransactionenvelope instead of streamedspanitems, because v10 defaults totraceLifecycle: 'static'. It also checksstatus === 'cancelled'. The BunskipIfand theRUNTIMEimport are dropped because v10's integration test utils have noRUNTIMEexport or Bun matrix.Verified locally. The new test passes on both the default path and with
INJECT_ORCHESTRION=true, and it fails on the default path without thepatch-layer.tschange. The fullsuites/expressintegration tests pass in both modes, as do the@sentry/coreexpress unit tests and the@sentry/server-utilsunit tests.via Junior system actor
junior.--
View Junior Session [Sentry]