Skip to content

Nuxt managed tunnel on Cloudflare drops the request body #26364

Open

Description

@sentry-junior

On Nuxt 4 (Nitro v2) with the cloudflare_module preset, the managed tunnel never answers. sentryCloudflareNitroPlugin drops the body of tunnel requests, so the SDK's tunnel handler ignores them and the app handles them instead. With an auth middleware, as in the nuxt-4 e2e app, the browser's tunnel requests get a 401.

Root cause

  • In the localFetch proxy of packages/nuxt/src/runtime/plugins/sentry-cloudflare.server.ts, the request passed to wrapRequestHandler gets its body only if isServedTunnelRequest({ method, url }) matches.
  • That check runs before wrapRequestHandler creates the per-request client. No client is current at that point, so getServedTunnel() returns nothing and the check is always false.
  • handleServedTunnelRequest() in wrapRequestHandlerWithInit skips a request without a body, so the request falls through to the app.
  • The check came in with feat(cloudflare): Answer managed tunnel requests in withSentry #25999.

Evidence (from a local wrangler dev run of the nuxt-4 e2e app, built without sentry.server.config.ts as the Cloudflare setup documents):

  • Unpatched, every tunnel POST to /app/qpo967 got 401 blocked by user auth, the first one and later ones alike.
  • With a log added at that check and the body passed unconditionally, the log printed SERVED? false /app/qpo967 for each tunnel POST. The tunnel then answered 200 and forwarded the envelope to the DSN host.
  • With the body passed on every request, tunnel-request-body.test.ts fails: the JSON body of a non-tunnel POST /api/post-error shows up as request.data on its error event. So the body can't just be passed for all requests.
  • The deleted nuxt-4-cloudflare tunnel test didn't catch this. Built from develop, its tunnel POST got 200 text/html from app.vue and forwarded nothing.

Reproduction

Related: #24838, #26285

via Isaac Schlueter.

--

View Session [Sentry]

Activity

  1. linear-code commented on Nov 13, 2026

    @linear-code
  2. isaacs commented on Nov 13, 2026

    @isaacs
    Member

    Comment thread that spawned this: #26285 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions