You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fda7a91
Browse filesBrowse the repository at this point in the historyBrowse files
`withSentry` from `@sentry/nextjs/cloudflare` wraps the Worker entry of a
Next.js app on Cloudflare Workers, e.g. `.open-next/worker.js` of OpenNext or
the fetch handler of vinext. It is `withSentry` of `@sentry/cloudflare` with
the Next.js handling added:
- It installs the OpenTelemetry async context strategy and context manager
at module load, so the spans of Next.js nest and keep their OpenTelemetry
context as on Node.js.
- Its client gets the span hooks and `ignoreSpans` of the server `init`, the
`use cache` integration, the Sentry propagator and the Next.js SDK
metadata.
- The propagator keeps the request span as parent when Next.js extracts an
incoming trace that the root span already continued. Next.js does this
when it misses its router server context, e.g. on Workers where
`process.cwd()` is `/bundle`, and each continued request then had two
segments.
- The request spans of Next.js (`BaseServer.handleRequest`) are ignored,
so the request span of `withSentry` is the only `http.server` span. Next.js
writes the route and status onto it, and the other Next.js spans become
its children.
- Requests to the tunnel route are not sampled.
- The server and edge `init` in `sentry.*.config.ts` create no client in the
Worker. They hand over the build release of `withSentryConfig`, which only
code that Next.js compiles can read.
The request root span of `@sentry/cloudflare` gets the route name of Next.js
at span end, and middleware no longer renames a root span that Next.js did
not start.
The `nextjs-16-cf-workers` e2e app now uses it. This runs the server tests
that were skipped, and adds tests for D1 spans, the OpenTelemetry context and
trace continuation. Its `compatibility_date` moves to 2026-02-19, the first
date on which Next.js extracts the incoming trace again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0 commit comments