Skip to content

test(nextjs): Run nextjs-16 on Bun, Deno and Cloudflare - #24999

Draft
JPeer264 wants to merge 1 commit into
jp/nextjs-cloudflare-entryfrom
jp/nextjs-16-runtime-variants
Draft

JPeer264 wants to merge 1 commit into
jp/nextjs-cloudflare-entryfrom
jp/nextjs-16-runtime-variants

Conversation

@JPeer264

@JPeer264 JPeer264 commented Oct 2, 2026

Copy link
Copy Markdown
Member

Folds nextjs-16-bun and nextjs-16-cf-workers into runtime variants of nextjs-16, so one suite runs on Node.js, Bun, Deno and Cloudflare Workers (OpenNext). Bun, Cloudflare and Cloudflare with the latest Next.js are required jobs, as the two old apps were. Deno is new and optional.

Not obvious from the diff:

  • Next.js loads instrumentation.ts on Bun and Deno too, so the app calls init() of @sentry/nextjs there and adds the request isolation and fetch integrations of @sentry/bun and @sentry/deno. The e2e README now says this, and that variants run as required jobs.
  • The mock AI server moves into the Playwright global setup, because a Worker can not start a node:http server. The OpenAI test now also runs on Workers.
  • The app does not depend on @opentelemetry/api directly. When the package is at the top of node_modules, the OpenNext build of the Node.js middleware fails to resolve it, because OpenNext bundles its ESM build but copies only its CommonJS build. npm puts it there for every app with @sentry/nextjs, so this OpenNext bug also hits npm users with a proxy.ts.
  • pg-cloudflare is in serverExternalPackages, because OpenNext copies the workerd build of a package only for the packages in that list.

Fixes #24830

🤖 Generated with Claude Code

nextjs-16 gets variants for Bun, Deno and Cloudflare Workers (OpenNext) and
replaces `nextjs-16-bun` and `nextjs-16-cf-workers`. Bun, Cloudflare and
Cloudflare with the latest Next.js are required jobs, as the two old apps
were. Deno is optional.

- Bun and Deno run `next start` on the same build as Node.js. The server
  config adds the integrations of `@sentry/bun` and `@sentry/deno` that
  replace the Node.js instrumentation these runtimes do not trigger. The
  e2e README now describes this, and that `variants` run as required jobs.
- Cloudflare builds with `opennextjs-cloudflare` and wraps the Worker in
  `worker.ts` with `withSentry` from `@sentry/nextjs/cloudflare`.
  `pg-cloudflare` is in `serverExternalPackages`, because OpenNext copies the
  `workerd` build of a package only when that list has the package.
- The app does not depend on `@opentelemetry/api` directly, because the
  OpenNext middleware bundle can not load an installed copy.
  `/api/otel-context` uses the copy of Next.js.
- The mock AI server runs in the Playwright global setup instead of the app,
  because a Worker can not start a `node:http` server. Thus the OpenAI test
  runs on every runtime.
- Tests branch on `getRuntime()` where the runtimes differ (segment origin
  and attributes, middleware spans in the request segment of the Worker,
  fetch span attributes). They skip what a runtime can not do: Node.js
  runtime metrics on Workers, and `pg` spans on Bun and Workers, which have
  no runtime module hook.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 29.52 kB - -
@sentry/browser - with treeshaking flags 27.68 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.57 kB - -
@sentry/browser (incl. Tracing) 51.45 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 51.46 kB - -
@sentry/browser (incl. Tracing, Profiling) 54.46 kB - -
@sentry/browser (incl. Tracing, Replay) 91.04 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.03 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 95.74 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 108.71 kB - -
@sentry/browser (incl. Feedback) 47.04 kB - -
@sentry/browser (incl. sendFeedback) 34.57 kB - -
@sentry/browser (incl. FeedbackAsync) 39.68 kB - -
@sentry/browser (incl. Metrics) 30.54 kB - -
@sentry/browser (incl. Logs) 30.82 kB - -
@sentry/browser (incl. Metrics & Logs) 31.48 kB - -
@sentry/react 31.36 kB - -
@sentry/react (incl. Tracing) 53.8 kB - -
@sentry/vue 37.51 kB - -
@sentry/vue (incl. Tracing) 54.33 kB - -
@sentry/svelte 29.55 kB - -
@sentry/remix (Remix 3 client bundle) 55.77 kB - -
CDN Bundle 31.22 kB - -
CDN Bundle (incl. Tracing) 51.98 kB - -
CDN Bundle (incl. Logs, Metrics) 33.46 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 53.91 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.2 kB - -
CDN Bundle (incl. Tracing, Replay) 89.56 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.53 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 95.72 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 97.71 kB - -
CDN Bundle - uncompressed 92.14 kB - -
CDN Bundle (incl. Tracing) - uncompressed 154.49 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 98.71 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 160.45 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 228.28 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 274.22 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 280.16 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 287.93 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 293.86 kB - -
@sentry/nextjs (client) 56.32 kB - -
@sentry/sveltekit (client) 51.87 kB - -
@sentry/core/server 40.59 kB - -
@sentry/core/browser 13.63 kB - -
@sentry/node 144.68 kB +0.01% +10 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.2 kB - -
@sentry/node - without tracing 93.24 kB +0.02% +11 B 🔺
@sentry/node - without channel injection 122.95 kB +0.01% +8 B 🔺
@sentry/aws-serverless 101.51 kB +0.01% +5 B 🔺
@sentry/cloudflare (withSentry) - minified 208.72 kB +0.06% +106 B 🔺
@sentry/cloudflare (withSentry) 518.61 kB +0.08% +401 B 🔺

View base workflow run

This branch has not been deployed

No deployments
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.

1 participant