Skip to content

[nextjs] Tunnel route requests are not dropped under the Next.request root span (Next.js 16.4.3+) #26093

Closed

Description

@chargome

Follow-up to #26005 (#26005).

Since Next.js 16.4.3, a proxy that runs separately from the render (for example on Vercel) gets a new Next.request root span. Middleware.execute becomes its child.

Our tunnel filter only looks at Middleware.execute and BaseServer.handleRequest spans. So for tunnel requests that go through the proxy, only the child span gets dropped. The Next.request root is still sent as a GET transaction (subject to the sample rate). This is noise, not a loop, because the server SDK sends straight to the DSN.

Affected code:

  • dropMiddlewareTunnelRequests() in packages/nextjs/src/common/utils/dropMiddlewareTunnelRequests.ts (the drop flag)
  • getTunnelRouteIgnoreSpans() in the same file (the ignoreSpans pattern used with span streaming)

vercel/next.js#100665 makes Middleware.execute the root again for requests the proxy answers itself. Requests that continue to a render keep the Next.request root, so we need the fix either way.

Related, possibly in the same PR: the Next.request root also gets the wrong name and op (GET middleware GET / http.server on Node, GET with no op on Edge). Before 16.4.3 these were middleware GET / http.server.middleware.

The nextjs-16-adapter e2e app from #26084 calls the proxy the way Vercel does, so it can cover this.

Activity

  1. self-assigned this
    on Nov 4, 2026
  2. linear-code commented on Nov 4, 2026

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

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions