Skip to content

feat(tanstackstart-react): Serve the managed tunnel from the server entry - #25408

Open
logaretm wants to merge 12 commits into
awad/tunnel-browser-managedfrom
awad/tunnel-tanstackstart
Open

logaretm wants to merge 12 commits into
awad/tunnel-browser-managedfrom
awad/tunnel-tanstackstart

Conversation

@logaretm

@logaretm logaretm commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

TanStack Start picked a random tunnel path per build and patched the generated route tree to serve it.

Because the new approach relies less on build-time, the logic was changed to wrap the server entrypoint instead and only route the matching tunnel requests to our handler.

This isn't a breaking change, previously we injected a single endpoint handler, now we inject a middleware since the DSN is only known at runtime.

closes #25461

@logaretm
logaretm added this pull request to stack #25201 October 15, 2026 15:13
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 30.53 kB +2.18% +649 B 🔺
@sentry/browser - with treeshaking flags 28.51 kB +1.75% +490 B 🔺
@sentry/browser - with treeshaking flags tracing without tracing 28.39 kB +1.7% +473 B 🔺
@sentry/browser (incl. Tracing) 52.77 kB +1.35% +699 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 52.77 kB +1.35% +698 B 🔺
@sentry/browser (incl. Tracing, Profiling) 55.74 kB +1.32% +721 B 🔺
@sentry/browser (incl. Tracing, Replay) 92.44 kB +0.68% +616 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.18 kB +0.62% +496 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 97.18 kB +0.66% +629 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 110.17 kB +0.63% +683 B 🔺
@sentry/browser (incl. Feedback) 48.09 kB +1.48% +699 B 🔺
@sentry/browser (incl. sendFeedback) 35.6 kB +1.9% +662 B 🔺
@sentry/browser (incl. FeedbackAsync) 40.73 kB +1.71% +683 B 🔺
@sentry/browser (incl. Metrics) 31.54 kB +2.05% +633 B 🔺
@sentry/browser (incl. Logs) 31.81 kB +2.01% +626 B 🔺
@sentry/browser (incl. Metrics & Logs) 32.48 kB +2.11% +670 B 🔺
@sentry/react 32.33 kB +2% +631 B 🔺
@sentry/react (incl. Tracing) 55.02 kB +1.17% +633 B 🔺
@sentry/vue 38.68 kB +1.7% +643 B 🔺
@sentry/vue (incl. Tracing) 55.72 kB +1.31% +716 B 🔺
@sentry/svelte 30.56 kB +2.2% +657 B 🔺
@sentry/remix (Remix 3 client bundle) 57.8 kB +1.26% +715 B 🔺
CDN Bundle 32.11 kB +1.49% +470 B 🔺
CDN Bundle (incl. Tracing) 53.06 kB +0.91% +478 B 🔺
CDN Bundle (incl. Logs, Metrics) 34.31 kB +1.41% +474 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 55.01 kB +0.89% +483 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 75.26 kB +0.66% +492 B 🔺
CDN Bundle (incl. Tracing, Replay) 90.73 kB +0.53% +478 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 92.66 kB +0.52% +479 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 96.87 kB +0.49% +468 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.83 kB +0.5% +489 B 🔺
CDN Bundle - uncompressed 94.33 kB +1.24% +1.15 kB 🔺
CDN Bundle (incl. Tracing) - uncompressed 157.19 kB +0.74% +1.15 kB 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 100.87 kB +1.16% +1.15 kB 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 163.14 kB +0.72% +1.15 kB 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 230.91 kB +0.51% +1.15 kB 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 277.35 kB +0.42% +1.15 kB 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 283.3 kB +0.41% +1.15 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 291.06 kB +0.4% +1.15 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 296.99 kB +0.39% +1.15 kB 🔺
@sentry/nextjs (client) 57.45 kB +1.08% +613 B 🔺
@sentry/sveltekit (client) 53.08 kB +1.2% +627 B 🔺
@sentry/core/server 42.85 kB +4.18% +1.72 kB 🔺
@sentry/core/browser 13.81 kB - -
@sentry/node 155.81 kB +0.47% +718 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 84.06 kB - -
@sentry/node - without tracing 97.48 kB +0.73% +701 B 🔺
@sentry/node - without channel injection 133.81 kB +0.52% +692 B 🔺
@sentry/aws-serverless 105.75 kB +0.78% +816 B 🔺
@sentry/cloudflare (withSentry) - minified 212.9 kB +0.96% +2.01 kB 🔺
@sentry/cloudflare (withSentry) 528.07 kB +0.94% +4.9 kB 🔺
@sentry/nextjs/cloudflare (withSentry) - minified 230.58 kB +0.89% +2.01 kB 🔺

View base workflow run

@logaretm
logaretm force-pushed the awad/tunnel-tanstackstart branch from 2202cda to 46e486c Compare October 15, 2026 15:36
@logaretm
logaretm force-pushed the awad/tunnel-tanstackstart branch 3 times, most recently from 9069686 to b589186 Compare October 15, 2026 17:15
@logaretm
logaretm force-pushed the awad/tunnel-tanstackstart branch 3 times, most recently from a5fcc1b to f2a6beb Compare October 15, 2026 18:16
@logaretm
logaretm force-pushed the awad/tunnel-tanstackstart branch 2 times, most recently from 722f4c6 to eec9ddf 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.

@logaretm
logaretm force-pushed the awad/tunnel-tanstackstart branch from eec9ddf to 8d3dee9 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.

@logaretm
logaretm force-pushed the awad/tunnel-tanstackstart branch from 8d3dee9 to 8c6c1fa Compare October 16, 2026 02:25
@logaretm
logaretm force-pushed the awad/tunnel-tanstackstart branch 2 times, most recently from 6b24a7b to 64c909f Compare October 16, 2026 14:00
@logaretm
logaretm force-pushed the awad/tunnel-tanstackstart branch from c1c3595 to 58c71ae Compare October 19, 2026 19:12
@logaretm
logaretm marked this pull request as ready for review October 19, 2026 19:36
@logaretm
logaretm requested a review from a team as a code owner October 19, 2026 19:36
@logaretm
logaretm requested review from chargome and s1gr1d and removed request for a team October 19, 2026 19:36
…ntry

The Vite plugin now wraps the app's server entry, so `Sentry.init({ tunnel: true })`
works with no build option and tunnel requests are answered before Start's
request middleware and routing. Every `tunnelRoute` form is served the same way:
`true` uses the DSN-derived path instead of a random one per build, and a static
path no longer patches the generated route tree.
…equests

The tunnel handler now answers a request without one with a 411.
@logaretm
logaretm requested review from a team as code owners October 19, 2026 20:07
@logaretm
logaretm requested review from JPeer264, Lms24, isaacs and mydea and removed request for a team October 19, 2026 20:07
@logaretm
logaretm force-pushed the awad/tunnel-tanstackstart branch from 58c71ae to cdbac44 Compare October 19, 2026 20:08

@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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit cdbac44. Configure here.

const serialized = defined?.define?.__SENTRY_TANSTACKSTART_TUNNEL_ROUTE__;
expect(typeof serialized).toBe('string');
expect(serialized).toMatch(/^"\/[a-z0-9]{8}"$/);
expect(options._managedTunnel).toEqual({ basePath: '/app' });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vite tests leak tunnel defaults

Low Severity

The new configureServer tests call setManagedTunnelDefaults (via the plugin) but never reset that module-level state. Sibling wrap tests already use _INTERNAL_resetManagedTunnelDefaults in afterEach. Leftover tunnel/basePath defaults can bleed into later files in the same Vitest worker and flake assertions about which path is served. Flagged because the review rules call out tests that are likely to flake.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit cdbac44. Configure here.

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.

TanStack Start managed tunnel

1 participant