Skip to content

fix(nuxt): Answer managed tunnel requests on Cloudflare - #26365

Merged
isaacs merged 1 commit into
developfrom
isaacschlueter/js-4102-nuxt-managed-tunnel-on-cloudflare
Nov 17, 2026
Merged

isaacs merged 1 commit into
developfrom
isaacschlueter/js-4102-nuxt-managed-tunnel-on-cloudflare

Conversation

@isaacs

@isaacs isaacs commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

sentryCloudflareNitroPlugin matched the tunnel before wrapRequestHandler created the client. No client was current, so the match always failed, the tunnel request got no body, and the app answered it instead of the SDK.

The plugin now matches the tunnel inside the wrapRequestHandler callback, where the client exists, and passes the body Nitro read only to the tunnel handler. Other requests still get no body, so their bodies stay off their events.

The nuxt-4-cloudflare tunnel e2e test only checked for a 200, which the app returns too. It now waits for the forwarded envelope, and it fails without this fix.

Closes #26364

@isaacs
isaacs added this pull request to stack #26366 November 13, 2026 16:15
@linear-code

linear-code Bot commented Nov 13, 2026

Copy link
Copy Markdown

JS-4102

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: 4f0d802 (PR test merge using develop at 8c8f0d4)

Against: 8c8f0d4 (develop) · base run #66474

✅ Baseline matches: this diff contains only this PR's changes.

Path Size % Change Change
@sentry/browser 30.1 kB - -
@sentry/browser - with treeshaking flags 28.3 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.2 kB - -
@sentry/browser (incl. Tracing) 52.28 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.29 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.25 kB - -
@sentry/browser (incl. Tracing, Replay) 92.82 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.6 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 97.21 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 110.6 kB - -
@sentry/browser (incl. Feedback) 47.73 kB - -
@sentry/browser (incl. sendFeedback) 30.69 kB - -
@sentry/browser (incl. FeedbackAsync) 35.69 kB - -
@sentry/browser (incl. Metrics) 31.43 kB - -
@sentry/browser (incl. Logs) 31.71 kB - -
@sentry/browser (incl. Metrics & Logs) 32.37 kB - -
@sentry/react 32.11 kB - -
@sentry/react (incl. Tracing) 54.95 kB - -
@sentry/vue 38.29 kB - -
@sentry/vue (incl. Tracing) 55.24 kB - -
@sentry/svelte 30.12 kB - -
@sentry/remix (Remix 3 client bundle) 58.06 kB - -
CDN Bundle 31.87 kB - -
CDN Bundle (incl. Tracing) 52.7 kB - -
CDN Bundle (incl. Logs, Metrics) 34.67 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.26 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 75.7 kB - -
CDN Bundle (incl. Tracing, Replay) 90.72 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.09 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.69 kB - -
CDN Bundle - uncompressed 92.98 kB - -
CDN Bundle (incl. Tracing) - uncompressed 155.45 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 101.33 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 163.08 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 231.44 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 275.61 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 283.24 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 287.4 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 295.02 kB - -
@sentry/nextjs (client) 58.57 kB - -
@sentry/sveltekit (client) 53.57 kB - -
@sentry/core/server 44.8 kB - -
@sentry/core/browser 14.4 kB - -
@sentry/node 151.66 kB -0.01% -6 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.33 kB - -
@sentry/node - without tracing 88.59 kB -0.01% -5 B 🔽
@sentry/node - without channel injection 140.62 kB -0.01% -4 B 🔽
@sentry/aws-serverless 98.96 kB -0.01% -8 B 🔽
@sentry/cloudflare (withSentry) - minified 206.71 kB - -
@sentry/cloudflare (withSentry) 479.81 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 232.07 kB - -

View base workflow run

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

All optional checks were successful. 8 successful. See the run.

Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E nuxt-5-cloudflare Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 37s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 42s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (kv-cache) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (development) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 36s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 2m Details

@s1gr1d s1gr1d left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see @mydea adding separate tests for the tunnel routes. Maybe it's worth putting this into a separate test as well?

@sentry-junior
sentry-junior Bot force-pushed the isaacschlueter/js-4102-nuxt-managed-tunnel-on-cloudflare branch from 7f46250 to 0a0de1a Compare November 17, 2026 10:13
Base automatically changed from feat/nuxt-4-runtime-variants to develop November 17, 2026 13:42
`sentryCloudflareNitroPlugin` matched the tunnel before
`wrapRequestHandler` created the client. No client was current, so the
match always failed, the tunnel request got no body, and the app
answered it instead of the SDK.

The plugin now matches the tunnel inside the `wrapRequestHandler`
callback, where the client exists, and passes the body Nitro read only
to the tunnel handler. Other requests still get no body, so their
bodies stay off their events.

The `nuxt-4-cloudflare` tunnel e2e test only checked for a 200, which
the app returns too. It now waits for the forwarded envelope, and it
fails without this fix.

Closes #26364

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@isaacs
isaacs force-pushed the isaacschlueter/js-4102-nuxt-managed-tunnel-on-cloudflare branch from 0a0de1a to 535d3e1 Compare November 17, 2026 13:42
@sentry-junior

sentry-junior Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

@s1gr1d The tunnel coverage now lives in its own test. Your review was on 7f46250, which made the nuxt-4 (tunnel-basepath-cloudflare) variant required. After that, #26393 moved the tunnel tests into the dedicated nuxt-4-tunnel app, and #26285 removed the tunnel variants from nuxt-4. So this PR no longer touches nuxt-4. Its e2e change is only in nuxt-4-tunnel/tests/tunnel.test.ts: it removes the Cloudflare test.fixme, so the shared managed tunnel suite runs in the required nuxt-4-tunnel (cloudflare) variant. The check that other POST bodies stay off error events is its own test, nuxt-4-tunnel/tests/request-body.test.ts.

The branch already sits on develop and has only this PR's commit, so no rebase or push was needed. Local runs at 535d3e1: nuxt-4-tunnel (cloudflare) 4 passed, sentry-cloudflare.server.test.ts 3 passed, and lint:types, oxlint and oxfmt are clean.

@isaacs
isaacs merged commit 13f8b42 into develop Nov 17, 2026
79 checks passed
@isaacs
isaacs deleted the isaacschlueter/js-4102-nuxt-managed-tunnel-on-cloudflare branch November 17, 2026 13:51
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.

Nuxt managed tunnel on Cloudflare drops the request body

3 participants