Skip to content

feat(nextjs)!: Remove middleware bypass for tunnel route requests - #24589

Merged
chargome merged 2 commits into
developfrom
feat/nextjs-remove-tunnel-middleware-skip
Sep 22, 2026
Merged

chargome merged 2 commits into
developfrom
feat/nextjs-remove-tunnel-middleware-skip

Conversation

@chargome

Copy link
Copy Markdown
Member

Follow-up to #24499.

In webpack builds, the middleware wrapper skipped the user's middleware for tunnel route requests so that middleware redirecting unauthenticated requests would not swallow Sentry events. Keeping that check in sync with the tunnel rewrite is fragile, and Turbopack builds never had it.

This removes the bypass so tunnel requests go through the user's middleware like any other request on both bundlers. Middleware that blocks unauthenticated requests globally has to exclude the tunnel route in its matcher, which requires a fixed string route instead of tunnelRoute: true.

Refs JS-3719

In webpack builds, the middleware wrapper returned early for requests to the
tunnel route so the user's middleware never ran for them. Turbopack builds never
had this behavior, and keeping the SDK's request matching in sync with the
tunnel rewrite is fragile. Tunnel requests now go through the user's middleware
like any other request. Users whose middleware blocks unauthenticated requests
need to exclude the tunnel route in their matcher.

Refs JS-3719
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@chargome chargome self-assigned this Sep 22, 2026
@chargome

Copy link
Copy Markdown
Member Author

bugbot run

@linear-code

linear-code Bot commented Sep 22, 2026

Copy link
Copy Markdown

JS-3719

@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 5df0122. Configure here.

Comment thread packages/nextjs/src/config/types.ts
@github-actions

github-actions Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.16 kB - -
@sentry/browser - with treeshaking flags 27.42 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.33 kB - -
@sentry/browser (incl. Tracing) 50.62 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 50.64 kB - -
@sentry/browser (incl. Tracing, Profiling) 53.62 kB - -
@sentry/browser (incl. Tracing, Replay) 90.21 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 79.31 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 94.9 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 107.85 kB - -
@sentry/browser (incl. Feedback) 46.69 kB - -
@sentry/browser (incl. sendFeedback) 34.22 kB - -
@sentry/browser (incl. FeedbackAsync) 39.32 kB - -
@sentry/browser (incl. Metrics) 30.18 kB - -
@sentry/browser (incl. Logs) 30.43 kB - -
@sentry/browser (incl. Metrics & Logs) 31.09 kB - -
@sentry/react 30.91 kB - -
@sentry/react (incl. Tracing) 52.91 kB - -
@sentry/vue 36.41 kB - -
@sentry/vue (incl. Tracing) 52.9 kB - -
@sentry/svelte 29.18 kB - -
CDN Bundle 30.86 kB - -
CDN Bundle (incl. Tracing) 51.12 kB - -
CDN Bundle (incl. Logs, Metrics) 33.12 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 53.09 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.84 kB - -
CDN Bundle (incl. Tracing, Replay) 88.7 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 90.63 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 94.76 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 96.75 kB - -
CDN Bundle - uncompressed 91.25 kB - -
CDN Bundle (incl. Tracing) - uncompressed 152.53 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.82 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 158.48 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 227.39 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 272.26 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 278.2 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 285.96 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 291.89 kB - -
@sentry/nextjs (client) 55.24 kB - -
@sentry/sveltekit (client) 51.04 kB - -
@sentry/core/server 39.93 kB - -
@sentry/core/browser 13.63 kB - -
@sentry/node 133.38 kB +0.02% +19 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 82.15 kB - -
@sentry/node - without tracing 89.93 kB +0.03% +22 B 🔺
@sentry/node - without channel injection 112.17 kB +0.02% +22 B 🔺
@sentry/aws-serverless 98.2 kB +0.02% +18 B 🔺
@sentry/cloudflare (withSentry) - minified 205.06 kB - -
@sentry/cloudflare (withSentry) 510.44 kB - -

View base workflow run

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@chargome
chargome requested a review from logaretm September 22, 2026 12:14
@chargome
chargome marked this pull request as ready for review September 22, 2026 12:15
@chargome
chargome requested a review from a team as a code owner September 22, 2026 12:15
@chargome
chargome requested review from nicohrubec and s1gr1d and removed request for a team September 22, 2026 12:15
@chargome
chargome merged commit 8b31bf1 into develop Sep 22, 2026
86 checks passed
@chargome
chargome deleted the feat/nextjs-remove-tunnel-middleware-skip branch September 22, 2026 13:44
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