Skip to content

feat: Accept tunnel: true in init to enable the managed tunnel - #25200

Draft
logaretm wants to merge 10 commits into
awad/tunnel-core-dsn-pathfrom
awad/tunnel-browser-managed
Draft

logaretm wants to merge 10 commits into
awad/tunnel-core-dsn-pathfrom
awad/tunnel-browser-managed

Conversation

@logaretm

@logaretm logaretm commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Previously the client side only accepted a string tunnel option so it sent the requests to that fixed endpoint, this PR effectively adds "managed" tunnel support that is generated automatically from the provided DSN.

This PR adds the tunnel options to the SDKs's init options and implements the client transport if the tunnel is provided.

closes #25460

@logaretm
logaretm added this pull request to stack #25201 October 8, 2026 15:45
@logaretm
logaretm force-pushed the awad/tunnel-browser-managed branch from ec2da8d to 2933944 Compare October 8, 2026 16:05
@logaretm logaretm changed the title feat(browser): Add applyManagedTunnel to point the tunnel at the DSN-derived path feat: Accept tunnel: true in init to enable the managed tunnel Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 30.61 kB +2.46% +734 B 🔺
@sentry/browser - with treeshaking flags 28.57 kB +1.96% +548 B 🔺
@sentry/browser - with treeshaking flags tracing without tracing 28.45 kB +1.9% +529 B 🔺
@sentry/browser (incl. Tracing) 52.84 kB +1.49% +773 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 52.86 kB +1.51% +786 B 🔺
@sentry/browser (incl. Tracing, Profiling) 55.83 kB +1.49% +816 B 🔺
@sentry/browser (incl. Tracing, Replay) 92.55 kB +0.8% +726 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.22 kB +0.67% +537 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 97.29 kB +0.77% +739 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 110.25 kB +0.7% +764 B 🔺
@sentry/browser (incl. Feedback) 48.19 kB +1.68% +793 B 🔺
@sentry/browser (incl. sendFeedback) 35.69 kB +2.16% +753 B 🔺
@sentry/browser (incl. FeedbackAsync) 40.82 kB +1.94% +776 B 🔺
@sentry/browser (incl. Metrics) 31.62 kB +2.33% +718 B 🔺
@sentry/browser (incl. Logs) 31.89 kB +2.28% +709 B 🔺
@sentry/browser (incl. Metrics & Logs) 32.56 kB +2.37% +752 B 🔺
@sentry/react 32.41 kB +2.25% +711 B 🔺
@sentry/react (incl. Tracing) 55.1 kB +1.33% +718 B 🔺
@sentry/vue 38.76 kB +1.9% +719 B 🔺
@sentry/vue (incl. Tracing) 55.79 kB +1.42% +781 B 🔺
@sentry/svelte 30.64 kB +2.49% +742 B 🔺
@sentry/remix (Remix 3 client bundle) 57.89 kB +1.42% +807 B 🔺
CDN Bundle 32.16 kB +1.64% +518 B 🔺
CDN Bundle (incl. Tracing) 53.11 kB +1% +524 B 🔺
CDN Bundle (incl. Logs, Metrics) 34.34 kB +1.49% +503 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 55.06 kB +0.99% +538 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 75.31 kB +0.73% +545 B 🔺
CDN Bundle (incl. Tracing, Replay) 90.76 kB +0.57% +508 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 92.69 kB +0.56% +514 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 96.92 kB +0.55% +522 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.89 kB +0.56% +547 B 🔺
CDN Bundle - uncompressed 94.5 kB +1.43% +1.32 kB 🔺
CDN Bundle (incl. Tracing) - uncompressed 157.36 kB +0.85% +1.32 kB 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 101.04 kB +1.33% +1.32 kB 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 163.31 kB +0.82% +1.32 kB 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 231.08 kB +0.58% +1.32 kB 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 277.52 kB +0.48% +1.32 kB 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 283.46 kB +0.47% +1.32 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 291.23 kB +0.46% +1.32 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 297.15 kB +0.45% +1.32 kB 🔺
@sentry/nextjs (client) 57.49 kB +1.23% +693 B 🔺
@sentry/sveltekit (client) 53.16 kB +1.36% +709 B 🔺
@sentry/core/server 42.92 kB +4.39% +1.8 kB 🔺
@sentry/core/browser 13.81 kB - -
@sentry/node 153.76 kB +0.45% +674 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 84.04 kB - -
@sentry/node - without tracing 95.53 kB +0.7% +659 B 🔺
@sentry/node - without channel injection 131.78 kB +0.49% +635 B 🔺
@sentry/aws-serverless 103.77 kB +0.72% +732 B 🔺
@sentry/cloudflare (withSentry) - minified 212.6 kB +0.96% +2.01 kB 🔺
@sentry/cloudflare (withSentry) 527.41 kB +0.94% +4.89 kB 🔺
@sentry/nextjs/cloudflare (withSentry) - minified 230.28 kB +0.88% +2.01 kB 🔺

View base workflow run

@logaretm
logaretm force-pushed the awad/tunnel-browser-managed branch from 2933944 to 4837dc0 Compare October 15, 2026 14:38
@logaretm
logaretm force-pushed the awad/tunnel-browser-managed branch 2 times, most recently from d5c110f to 4ab6297 Compare October 15, 2026 14:44
@logaretm
logaretm force-pushed the awad/tunnel-browser-managed branch from 4ab6297 to bf1d62c Compare October 15, 2026 14:47
@logaretm
logaretm force-pushed the awad/tunnel-browser-managed branch 3 times, most recently from 75a299e to b1553a8 Compare October 15, 2026 15:36
@logaretm
logaretm force-pushed the awad/tunnel-browser-managed branch from b1553a8 to 0e573ca Compare October 15, 2026 15:51
@logaretm logaretm changed the title feat: Accept tunnel: true in init to enable the managed tunnel feat: Accept tunnel: true in the SDKs that serve the managed tunnel Oct 15, 2026
@logaretm
logaretm force-pushed the awad/tunnel-browser-managed branch from 1d77f74 to 80f1700 Compare October 15, 2026 17:15
@logaretm logaretm changed the title feat: Accept tunnel: true in the SDKs that serve the managed tunnel feat: Accept tunnel: true in init to enable the managed tunnel Oct 15, 2026
@logaretm
logaretm force-pushed the awad/tunnel-browser-managed branch 4 times, most recently from a769b10 to d79df66 Compare October 15, 2026 18:28
@logaretm

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.

Stale Bugbot comment from a previous run.

Comment thread packages/core/src/client.ts Outdated
Comment thread packages/browser/src/utils/managedTunnel.ts
@logaretm
logaretm force-pushed the awad/tunnel-browser-managed branch from d79df66 to 8717465 Compare October 16, 2026 01:51
@logaretm

Copy link
Copy Markdown
Member Author

bugbot run

1 similar comment
@logaretm

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.

Stale Bugbot comment from a previous run.

Comment thread packages/aws-serverless/src/init.ts
Comment thread packages/browser/test/utils/managedTunnel.test.ts
@logaretm

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!

2 issues from previous reviews remain unresolved.

Fix All in Cursor

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

Reviewed by Cursor Bugbot for commit 3fcc2f7. Configure here.

@logaretm
logaretm force-pushed the awad/tunnel-browser-managed branch from 3fcc2f7 to f103bee Compare October 16, 2026 04:23
@logaretm
logaretm force-pushed the awad/tunnel-browser-managed branch 2 times, most recently from 3c75b20 to fb8f94d Compare October 16, 2026 14:37
@linear-code

linear-code Bot commented Oct 16, 2026

Copy link
Copy Markdown

JS-3942

@logaretm
logaretm force-pushed the awad/tunnel-browser-managed branch 3 times, most recently from 8b1748f to d7623cf Compare October 16, 2026 21:02
@logaretm
logaretm force-pushed the awad/tunnel-browser-managed branch 2 times, most recently from e67a181 to 3bdd3a2 Compare October 19, 2026 02:38
Setting `tunnel: true` (or `{ allowedDsns, basePath, trailingSlash }`) in both
the browser and the server `init` enables the managed tunnel. The browser
resolves it to the DSN-derived same-origin path and sends envelopes as
`application/x-sentry-envelope`, because SvelteKit and Astro CSRF checks reject
a same-origin `text/plain` POST. Server SDKs keep their own envelopes going
directly to Sentry and set `_managedTunnel` for their request handlers.
With `debug: true`, the client warns once when a managed tunnel request gets a
403, 404 or 405, pointing at the server side: a meta-framework SDK, an endpoint
calling `handleTunnelRequest`, or `allowedDsns`.
…port, and import server helpers from core/server

Only the browser sends to a managed tunnel, so the warning moves from the shared Client into the browser's tunnel transport. Server SDKs import resolveServerTunnelOption from @sentry/core/server.
@logaretm
logaretm force-pushed the awad/tunnel-browser-managed branch from 1496bcb to 04cf6f0 Compare October 19, 2026 04:58

This branch has not been deployed

No deployments
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.

Managed tunnel in core and browser

1 participant