GeezerVison is showing github.com — feat(core): Add the primitives to answer managed tunnel requests in the runtimes by logaretm · Pull Request #25997 · getsentry/sentry-javascript
Conversation
logaretm
commented
Nov 2, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
These series of PRs re-work the new tunnel implementation a second time, it acts as improvement because none of the changes are breaking.
What's different?
The new approach here, sets us up to intercept the tunnel request on the runtime level. This means it is much earlier than the current middleware approach, the tunnel request shouldn't hit the user application at all.
This allows the serveTunnelIntegration to be able to set up the tunnel handling on its own without requiring the user to add a manual handler on their own.
For frameworks it doesn't change much, but for arbitrary server setups, it becomes much easier:
// that's it!
Sentry.init({
integrations: [
Sentry.serveTunnelIntegration()
]
});
There is no need to setup routes or handlers unless the user explicity turns it off by either not using the integration or by turning the interception off.
// integration still adds some needed ignoreSpan rules
// to avoid tunnel requests from showing up in their traces
Sentry.serveTunnelIntegration({ intercept: false })
This PR
This PR adds primitive utilities and adjusts the API in a way to make it setup the changes up the stack.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
logaretm
changed the title
awad/runtime tunnel core
feat(core): Add the primitives to answer managed tunnel requests in the runtimes
Nov 2, 2026
size-limit report 📦
Compared: 31201fb (PR test merge using develop at 2f26678)
Against: 2f26678 (develop) · base run #65292
✅ Baseline matches: this diff contains only this PR's changes.
| Path |
Size |
% Change |
Change |
| @sentry/browser |
29.92 kB |
- |
- |
| @sentry/browser - with treeshaking flags |
28.08 kB |
- |
- |
| @sentry/browser - with treeshaking flags tracing without tracing |
27.97 kB |
- |
- |
| @sentry/browser (incl. Tracing) |
52.2 kB |
- |
- |
| @sentry/browser (incl. Tracing + Span Streaming) |
52.22 kB |
- |
- |
| @sentry/browser (incl. Tracing, Profiling) |
55.18 kB |
- |
- |
| @sentry/browser (incl. Tracing, Replay) |
92.52 kB |
- |
- |
| @sentry/browser (incl. Tracing, Replay) - with treeshaking flags |
81.2 kB |
- |
- |
| @sentry/browser (incl. Tracing, Replay with Canvas) |
97.25 kB |
- |
- |
| @sentry/browser (incl. Tracing, Replay, Feedback) |
110.25 kB |
- |
- |
| @sentry/browser (incl. Feedback) |
47.52 kB |
- |
- |
| @sentry/browser (incl. sendFeedback) |
35.02 kB |
- |
- |
| @sentry/browser (incl. FeedbackAsync) |
40.13 kB |
- |
- |
| @sentry/browser (incl. Metrics) |
31.48 kB |
- |
- |
| @sentry/browser (incl. Logs) |
31.77 kB |
- |
- |
| @sentry/browser (incl. Metrics & Logs) |
32.45 kB |
- |
- |
| @sentry/react |
31.78 kB |
- |
- |
| @sentry/react (incl. Tracing) |
54.62 kB |
- |
- |
| @sentry/vue |
38.24 kB |
- |
- |
| @sentry/vue (incl. Tracing) |
55.24 kB |
- |
- |
| @sentry/svelte |
29.95 kB |
- |
- |
| @sentry/remix (Remix 3 client bundle) |
57.83 kB |
- |
- |
| CDN Bundle |
31.72 kB |
- |
- |
| CDN Bundle (incl. Tracing) |
52.81 kB |
- |
- |
| CDN Bundle (incl. Logs, Metrics) |
34.52 kB |
- |
- |
| CDN Bundle (incl. Tracing, Logs, Metrics) |
55.32 kB |
- |
- |
| CDN Bundle (incl. Replay, Logs, Metrics) |
75.9 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay) |
90.98 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay, Logs, Metrics) |
93.54 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay, Feedback) |
97.11 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) |
99.71 kB |
- |
- |
| CDN Bundle - uncompressed |
92.76 kB |
- |
- |
| CDN Bundle (incl. Tracing) - uncompressed |
155.77 kB |
- |
- |
| CDN Bundle (incl. Logs, Metrics) - uncompressed |
101.29 kB |
- |
- |
| CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed |
163.55 kB |
- |
- |
| CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed |
232.85 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay) - uncompressed |
277.46 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed |
285.23 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed |
291.17 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed |
298.92 kB |
- |
- |
| @sentry/nextjs (client) |
57.64 kB |
- |
- |
| @sentry/sveltekit (client) |
52.73 kB |
- |
- |
| @sentry/core/server |
44.19 kB |
+0.85% |
+371 B 🔺 |
| @sentry/core/browser |
13.93 kB |
- |
- |
| @sentry/node |
157.04 kB |
+0.21% |
+318 B 🔺 |
| @sentry/node/import (ESM hook with diagnostics-channel injection) |
82.28 kB |
- |
- |
| @sentry/node - without tracing |
96.9 kB |
+0.31% |
+296 B 🔺 |
| @sentry/node - without channel injection |
137.33 kB |
+0.22% |
+291 B 🔺 |
| @sentry/aws-serverless |
105.52 kB |
+0.25% |
+261 B 🔺 |
| @sentry/cloudflare (withSentry) - minified |
200.99 kB |
+0.45% |
+895 B 🔺 |
| @sentry/cloudflare (withSentry) |
498.92 kB |
+0.37% |
+1.82 kB 🔺 |
| @sentry/nextjs/cloudflare (withSentry) - minified |
222.85 kB |
+0.41% |
+895 B 🔺 |
View base workflow run
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Optional E2E tests
Some optional checks were not successful. They do not block the merge. 6 not successful, 50 successful. See the run.
|
Check |
Status |
|
| ❌ |
CI: Optional E2E Tests / E2E cloudflare-pi-durable (latest) Test (optional) |
Failing after 36s |
Details |
| ❌ |
CI: Optional E2E Tests / E2E node-eve Test (optional) |
Failing after 2m |
Details |
| ❌ |
CI: Optional E2E Tests / E2E node-eve (latest) Test (optional) |
Failing after 54s |
Details |
| ❌ |
CI: Optional E2E Tests / E2E nextjs-16-cacheComponents (cloudflare) Test (optional) |
Failing after 10m |
Details |
| ❌ |
CI: Optional E2E Tests / E2E node-eve (orchestrion) Test (optional) |
Failing after 2m |
Details |
| ❌ |
CI: Optional E2E Tests / E2E node-flue (latest) Test (optional) |
Failing after 26s |
Details |
Successful checks
|
Check |
Status |
|
| ✅ |
CI: Optional E2E Tests / E2E cloudflare-pi-durable Test (optional) |
Successful in 46s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E cloudflare-flue-send-to-sentry Test (optional) |
Successful in 2m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E debug-id-sourcemaps Test (optional) |
Successful in 34s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E vue-3 (no Options API) Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-14 (latest) Test (optional) |
Successful in 2m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) |
Successful in 50s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E gen-ai-libraries (latest) Test (optional) |
Successful in 56s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E cloudflare-think Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E gen-ai-libraries (cloudflare) Test (optional) |
Successful in 42s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) |
Successful in 34s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E cloudflare-agent Test (optional) |
Successful in 43s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E astro-7-static Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E cloudflare-workers-send-to-sentry Test (optional) |
Successful in 3m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) |
Successful in 2m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E cloudflare-think (ai v6) Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nestjs-12 (latest) Test (optional) |
Successful in 42s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) |
Successful in 2m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E astro-7 Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) |
Successful in 2m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E gen-ai-libraries Test (optional) |
Successful in 52s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E cloudflare-mastra Test (optional) |
Successful in 51s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-express-send-to-sentry Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E deno (latest) Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) |
Successful in 2m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-orpc Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-fastify-6 Test (optional) |
Successful in 40s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) |
Successful in 3m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5 (tunnel-dev) Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-openai-decisions Test (optional) |
Successful in 31s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-pi-durable Test (optional) |
Successful in 36s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) |
Successful in 36s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-flue Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-mastra (latest) Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-fastify-6 (tracer provider) Test (optional) |
Successful in 34s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E supabase-nextjs Test (optional) |
Successful in 2m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-openai-decisions (latest) Test (optional) |
Successful in 36s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-express-mcp-v2 Test (optional) |
Successful in 30s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) |
Successful in 36s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E solidstart-2 Test (optional) |
Successful in 58s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) |
Successful in 2m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) |
Successful in 41s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-16 (deno) Test (optional) |
Successful in 2m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-mastra Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5 Test (optional) |
Successful in 2m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-pi-durable (latest) Test (optional) |
Successful in 36s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E react-send-to-sentry Test (optional) |
Successful in 3m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-express-mcp-v1 Test (optional) |
Successful in 37s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-express-send-to-sentry-static Test (optional) |
Successful in 1m |
Details |
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
cursor
Bot
left a comment
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stale Bugbot comment from a previous run.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 3, 2026
cursor
Bot
left a comment
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stale Bugbot comment from a previous run.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The store is a good simplification. Biggest concern is the abort-on-disconnect comment. Also need to make sure we don't land this without the rest of the stack on top of it.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…he runtimes
Matching and answering helpers for the tunnel `serveTunnelIntegration` serves, which never throw into the
server, the `intercept` option, and the managed tunnel state on the global carrier so every copy of core sees
it. Tunnel requests record no span, session or request data.
With `intercept: false` the app handles tunnel requests, so scope data its middleware sets leaked onto the
default isolation scope and into later requests.
… the app answers
Without `AsyncLocalStorage` the tunnel branch skipped the isolation scope reset, so an error the app captured while
answering a tunnel request with `intercept: false` carried the previous request's data. Errors its own handler
threw weren't captured at all. The tunnel check also uses the wrapper's client now.
The forward to Sentry aborted when the browser disconnected, so an envelope the server already received in full was
lost. A browser that leaves mid-upload still fails the forward, since its body breaks off, and a timeout now bounds
a hanging Sentry.
A forward that threw right away handed the request to the app, and building the Node request created its body
iterator first. The request is now built before the claim without touching the body, and a throw after the claim
ends in a 502.
On slow runners the browser left before the tunnel contacted Sentry, so the mid-upload test only saw the tunnel
reject the broken body and never an upload that broke off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 2 potential issues.

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit bf844da. Configure here.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
tunnelIsolationScope.setClient(client);
|
|
|
|
|
|
return withIsolationScope(tunnelIsolationScope, () => target.apply(thisArg, args));
|
|
|
}
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tunnel errors omit request data
Medium Severity
The Node isServedTunnelRequest path clones an isolation scope but never sets normalizedRequest. Errors thrown while the app answers a tunnel request with intercept: false are captured without method or URL, unlike the WinterCG handler which attaches request data (without the body).
Reviewed by Cursor Bugbot for commit bf844da. Configure here.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
|
|
|
// Tunnel requests record no session or span. The app may still answer them (`intercept: false`), so they keep
|
|
|
// their own isolation scope.
|
|
|
if (isServedTunnelRequest(request)) {
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tunnel match ignores known client
Low Severity
This is more an "is this necessary" check than a hard violation: isServedTunnelRequest(request) calls getClient() internally even though client is already in hand. wrapServerRequestHandler in this same PR passes that client through.
Triggered by project rule: PR Review Guidelines for Cursor Bot
Reviewed by Cursor Bugbot for commit bf844da. Configure here.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
logaretm
added a commit
that referenced
this pull request
Nov 6, 2026
…25998)
This PR actually delivers the approach outlined in #25997 by hooking up
the new utilities and wiring them up to the runtimes appropriately.
The implementation introduces a new integration factory that creates an
integration for each runtime, it accepts a runtime-specific server
patcher, and it applies the HTTP patch itself.
### For Node.js / http module
For Node, and other runtimes that emit the http module's diagnostic
channel, we patch the server emit and handle the request before it ever
hits the user application.
### For Deno / Bun
It does the same thing as in Node, but also adds a `*.serve` patch
in-case the user is using the native runtime servers.
Note for reviewers: if you are lacking context on this PR, check #25997
logaretm
added a commit
that referenced
this pull request
Nov 6, 2026
)
Adds the tunnel handling logic to our CF workers wrapper, and re-wires
astro and other CF capable frameworks.
Note for reviewers: if you are lacking context on this PR, check #25997
logaretm
added a commit
that referenced
this pull request
Nov 6, 2026
…26000)
Adds an AWS handler shim that handles tunnel events before they hit the
user handler.
Note for reviewers: if you are lacking context on this PR, check #25997
logaretm
added a commit
that referenced
this pull request
Nov 6, 2026
At this point, we handle the runtimes we support, so the previous
framework-specific wiring is no longer needed.
This PR adjusts a couple of wiring for some safety around double inits
in serverless environments, and cleans up most of the old code
introduced in `11.10`.
Note for reviewers: if you are lacking context on this PR, check #25997
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|