Repository navigation
fix(nuxt): Fix db0 and Cloudflare span data, run nuxt-4 on Bun, Deno and Cloudflare - #26285
sentry-junior[bot] wants to merge 8 commits into
Conversation
size-limit report 📦Compared: ad4bbc3 (PR test merge using develop at 075093d) Against: 075093d (develop) · base run #66039 ✅ Baseline matches: this diff contains only this PR's changes.
|
Optional E2E testsSome optional checks were not successful. They do not block the merge. 5 not successful, 56 successful. See the run.
Successful checks
|
isaacs
left a comment
There was a problem hiding this comment.
The title is test(e2e), but the PR changes released SDK behavior in @sentry/nuxt and @sentry/server-utils. The changelog comes from PR titles, so these changes would not show up there. The db.system.name change in packages/nuxt/src/runtime/utils/instrumentDatabase.ts line 77 is visible to users. Spans that had mysql2, planetscale, cloudflare-d1, better-sqlite3 or pglite now report mysql, sqlite or postgresql. That is correct by the OTel conventions, but it can break saved queries, alerts and dashboards that filter on the old values. Removing the sentry.server plugin on Cloudflare and the new transaction name on Cloudflare error events also change what users see.
Suggestion: Move the SDK changes into one or more fix(nuxt) / fix(server-utils) PRs that land first, with a changelog line for the db.system.name change. Then this PR stays a pure test(e2e) change. If splitting costs too much, at least retitle to fix(nuxt): ... and list the SDK changes in the description and the changelog.
The runtime-matrix approach is good. One app for four runtimes, with RUNTIME branches that each give a reason, is easier to maintain than separate apps. The new server tests (isolation, trace continuation, outgoing fetch propagation, logs) add coverage that had real gaps. The Bun and Deno setup follows the nextjs-16 convention and the README explains it well. The prepare-throws capture and the dialect-based db.system.name are correct fixes.
Concern 1 blocks the merge. The Cloudflare variant tests a setup that the SDK warns against, so its green result covers instrumentation that documented Cloudflare users do not get. It also seems to be the reason for the nitroServer.ts change, and maybe for the tunnel failure. Concerns 2 and 3 depend on how concern 1 is resolved. Concern 4 is a small but real correctness risk in code that runs on every runtime. It has a simple fix.
|
Thanks for the review. Changes for the review body:
|
|
bugbot run |
Runs the nuxt-4 suite on Node, Bun, Deno and Cloudflare from one app, following react-router-8-framework, and folds nuxt-4-cloudflare into it. Fixes the SDK defects the variants surfaced: db0 spans and prepare errors on bun-sqlite, Bun CommonJS namespaces in the orchestrion interop, and on Cloudflare the missing transaction name of request events and the tracing meta tags on cached HTML. Ref #24838 Co-Authored-By: Isaac Schlueter <isaac.schlueter@sentry.io>
…and require the runtime variants The Vite server variant builds no server/ directory, like the other server route tests note. Bun, Deno and Cloudflare passed in CI, so they move to the required variants. The Cloudflare tunnel variant stays optional. Co-Authored-By: Isaac Schlueter <isaac.schlueter@sentry.io>
With a server config, the module adds the sentry.server plugin on every preset. On Cloudflare, sentryCloudflareNitroPlugin already adds the page meta tags, so cached pages got two sentry-cache-origin tags.
…r too The prerenderer is built from the original config with the nitro-prerender preset, so pre-rendered pages still got both plugins' meta tags.
…he function An ES module with a default function and a named `name` export matched the Bun check and lost its named exports. Co-Authored-By: Isaac Schlueter <isaac.schlueter@sentry.io>
…setup The Cloudflare variant now builds without sentry.server.config.ts, as the Cloudflare setup documents. Without it the module added no route detector, so page server spans were named after the method only. The module now adds it on both setups. This makes the Cloudflare-only removal of the sentry.server plugin unneeded, so it is reverted. Co-Authored-By: Isaac Schlueter <isaac.schlueter@sentry.io>
daf5de9 to
32ee1da
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 32ee1da. Configure here.
|
Remaining issue will be addressed by #26365, next in the stack. |

Why: Runs the
nuxt-4suite on Node, Bun, Deno and Cloudflare from one app, following #24598 (runtime matrix key, runtime files, README convention), and foldsnuxt-4-cloudflareinto it.@sentry/nuxtbundlessentry.server.config.tsinto the Nitro output, so Bun and Deno start.output/server/index.mjswith no preload. Their runtime config files add the@sentry/bun/@sentry/denointegrations, the same waynextjs-16does. The Cloudflare variants test the documented Cloudflare setup: they build withcloudflare_module, set up the SDK withsentryCloudflareNitroPlugin, and deletesentry.server.config.tsbeforenuxt build, because a runtime file can replace a file but not remove it. Without that file the module adds no db0, storage, cache or middleware instrumentation, so those tests skip on Cloudflare with that reason. New tests cover per-request isolation, incoming trace continuation, outgoingfetchwithsentry-trace/baggage, logs, and POST errors. Where runtimes really differ, the suite branches onRUNTIMEand says why in a comment.SDK changes the variants surfaced. They change what users see:
@sentry/nuxt, user-visible: db0 spans setdb.system.namefrom the connector's dialect (mysql,postgresql,sqlite) instead of the connector name. For example,mysql2andplanetscalebecomemysql, andbetter-sqlite3,cloudflare-d1andbun-sqlitebecomesqlite. This follows the OTel conventions, but saved queries, alerts and dashboards that filter on the old values need updating, soCHANGELOG.mdhas an entry under Important Changes.@sentry/nuxt: db0 spans onbun-sqlite/node-sqlitegetdb.namespace, and errors that eager connectors (bun-sqlite,better-sqlite3) throw fromprepareare captured.@sentry/nuxton Cloudflare: the module adds the page route detector without a server config too, so page server spans are named after their route (GET /test-param/:param()). Before, they were namedGETonly. Error events of a request get a transaction name (GET /api/...), asnode:httpgives them on Node.@sentry/server-utils: the orchestrion CommonJS interop unwraps Bun's namespaces of CommonJS function exports. It only does so when every key mirrors the function, so an ES module that exports anamenext to its default function keeps its named exports.Runtime differences the suite asserts as they are, not as defects: Worker origin is
auto.http.cloudflare. The Worker build is minified. On Deno, a startup crash exits 0. The mongoose route is a stub on Cloudflare, because Nitro's Cloudflare preset can't bundle themongodbdriver even without Sentry (its optionalrequire('@aws-sdk/credential-providers')fails with "externals are not allowed").Split out, not fixed here:
nuxt-4 (tunnel-basepath-cloudflare)stays optional.sentryCloudflareNitroPluginpasses the request body only ifisServedTunnelRequest()matches, and it runs beforewrapRequestHandlercreates the per-request client. So it never matches, the body is dropped, and the app answers the tunnel (here 401 from the auth middleware). It fails the same with the documented setup (no server config). Passing the body for every request makes the tunnel tests pass, buttunnel-request-body.test.tsthen shows that the body of other POSTs ends up on their error events. A fix needs a design call on matching the tunnel before the client exists, so it gets its own PR. The deletednuxt-4-cloudflaretunnel test did not cover this: built fromdevelop, its tunnel POST got a 200 HTML page fromapp.vueand forwarded nothing, so it passed without the tunnel answering.sentry-transaction. The plugin reads the trace data when the request starts, before the route is known.onUnhandledRejection(modewarn) catches module-evaluation errors, which Deno routes tounhandledRejection.How to review: Start with
tests/runtime.tsand theRUNTIMEbranches, thennuxt.config.ts,cloudflare/sentry.tsand the Cloudflare build scripts inpackage.json. The SDK changes are small, each with unit or e2e tests.Unsure about: No required check covers the Cloudflare managed tunnel until #26364 is fixed. The old required test did not cover it either (see above).
Closes #24838
Local runs and CI
Local runs on the latest commit's SDK tarballs:
test:assert: 82 passed, 3 skipped (prod). 7 passed, 1 skipped (dev).tunnel-basepath(no server config): 1 passed, 2 failed (defect 1)@sentry/nuxtunit tests: 476 passed, 1 failed.test/vite/sourceMaps-nuxtHooks.test.tsfails ondeveloptoo.@sentry/server-utilsorchestrion tests: 185 passed.lint:typesof both packages and oxlint pass.Bun and Deno were not run locally for this commit. Earlier local runs gave Bun 82 passed and Deno 2.9.0 82 passed, 3 skipped each. CI covers them.
via Isaac Schlueter.
--
View Session [Sentry]