Skip to content

fix(v10/server-utils): End Express layer spans when the client aborts - #25256

Merged
chargome merged 1 commit into
v10from
backport/v10-express-span-client-abort
Oct 12, 2026
Merged

chargome merged 1 commit into
v10from
backport/v10-express-span-client-abort

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Backport of: #25209

Differences to the original PR

  • packages/server-utils/src/integrations/tracing-channel/express/{instrumentation,types}.ts: The original changes packages/server-utils/src/integrations/express/. On v10 that code is at integrations/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 import hasSpanStreamingEnabled and the span name fallbacks) and the code comment, which now names v10's asyncEnd/beforeSpanEnd flow.
  • packages/core/src/integrations/express/patch-layer.ts (new, not in the original): v10's default Express instrumentation is still patchExpressModule in @sentry/core. That code was removed from develop, and it has the same finish-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 same close handling: the layer span ends on close, gets status cancelled, and both listeners are removed when the span ends via finish, close, or next(). 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 static transaction envelope instead of streamed span items, because v10 defaults to traceLifecycle: 'static'. It also checks status === 'cancelled'. The Bun skipIf and the RUNTIME import are dropped because v10's integration test utils have no RUNTIME export 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 the patch-layer.ts change. The full suites/express integration tests pass in both modes, as do the @sentry/core express unit tests and the @sentry/server-utils unit tests.

via Junior system actor junior.

--

View Junior Session [Sentry]

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.23 kB added added
@sentry/browser - with treeshaking flags 26.67 kB added added
@sentry/browser (incl. Tracing) 47.11 kB added added
@sentry/browser (incl. Tracing + Span Streaming) 48.91 kB added added
@sentry/browser (incl. Tracing, Profiling) 51.9 kB added added
@sentry/browser (incl. Tracing, Replay) 86.52 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 76.15 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 91.26 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 103.9 kB added added
@sentry/browser (incl. Feedback) 45.41 kB added added
@sentry/browser (incl. sendFeedback) 33.03 kB added added
@sentry/browser (incl. FeedbackAsync) 38.17 kB added added
@sentry/browser (incl. Metrics) 29.32 kB added added
@sentry/browser (incl. Logs) 29.55 kB added added
@sentry/browser (incl. Metrics & Logs) 30.23 kB added added
@sentry/react 30.03 kB added added
@sentry/react (incl. Tracing) 49.45 kB added added
@sentry/vue 34.04 kB added added
@sentry/vue (incl. Tracing) 49.51 kB added added
@sentry/svelte 28.25 kB added added
CDN Bundle 30.6 kB added added
CDN Bundle (incl. Tracing) 49.07 kB added added
CDN Bundle (incl. Logs, Metrics) 32.17 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 50.41 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 71.6 kB added added
CDN Bundle (incl. Tracing, Replay) 86.78 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.05 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 92.57 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 93.87 kB added added
CDN Bundle - uncompressed 90.97 kB added added
CDN Bundle (incl. Tracing) - uncompressed 147.97 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 95.68 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 151.95 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 221.03 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 267.79 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 271.75 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 281.49 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 285.44 kB added added
@sentry/nextjs (client) 51.98 kB added added
@sentry/sveltekit (client) 47.56 kB added added
@sentry/core/server 81.55 kB added added
@sentry/core/browser 67.64 kB added added
@sentry/node-core 63.87 kB added added
@sentry/node 127.06 kB added added
@sentry/node (incl. diagnostics channel injection) 171.24 kB added added
@sentry/node/import (ESM hook with diagnostics-channel injection) 166 B added added
@sentry/node/light 51.99 kB added added
@sentry/node - without tracing 75.65 kB added added
@sentry/aws-serverless 84.81 kB added added
@sentry/cloudflare (withSentry) - minified 204.74 kB added added
@sentry/cloudflare (withSentry) 504.74 kB added added

@chargome
chargome marked this pull request as ready for review October 12, 2026 09:09
@chargome
chargome requested review from a team as code owners October 12, 2026 09:09
@chargome
chargome requested review from isaacs and mydea and removed request for a team October 12, 2026 09:09
@chargome
chargome requested review from andreiborza and removed request for isaacs and mydea October 12, 2026 09:09
@chargome
chargome merged commit e1b3125 into v10 Oct 12, 2026
622 of 625 checks passed
@chargome
chargome deleted the backport/v10-express-span-client-abort branch October 12, 2026 09:27
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.

2 participants