Repository navigation
feat(tanstackstart-react): Initialize the SDK when the Nitro server starts - #26224
Merged
Merged
Conversation
…arts
Nitro imports the server entry lazily in the first request, so a Sentry.init()
imported from server.ts misses the http.server span of the first request of
each server instance when the app runs without node --import.
The Vite plugin now loads instrument.server.{ts,mts,js,mjs} from a Nitro
plugin, which runs at server startup, and the server init() keeps the first
client so an existing --import or server entry import doesn't replace it.
Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Optional E2E testsSome optional checks were not successful. They do not block the merge. 6 not successful, 51 successful. See the run.
Successful checks
|
Contributor
size-limit report 📦Compared: 4d19c73 (PR test merge using develop at 2f3c8a9) Against: 2f3c8a9 (develop) · base run #65503 ✅ Baseline matches: this diff contains only this PR's changes.
|
Drop the serverInstrumentationFile option: like Nuxt, the server config is found by name and always bundled into the Nitro build. Skip Sentry.init() while TanStack Start prerenders, and tell users that a --import preload or an import in the server entry is no longer needed when a second init is skipped. The tanstackstart-react e2e app now starts without --import. tanstackstart-react-static keeps it, which covers existing start commands. Co-Authored-By: Francesco Gringl-Novy <francesco.novy@sentry.io>
mydea
marked this pull request as ready for review
November 10, 2026 10:39
…erver Co-Authored-By: Francesco Gringl-Novy <francesco.novy@sentry.io>
chargome
marked this pull request as draft
November 10, 2026 11:47
…hout Node.js Nitro marks worker presets, such as Vercel Edge and Netlify Edge, and Deno Deploy with `node: false`. The Node SDK must not end up in those builds, not only on Cloudflare. Also logs with debug enabled when no instrument.server file is found or the preset is skipped, and uses the convention constants in the first request e2e test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 2dc2627. Configure here.
…are presets Nitro's Cloudflare presets extend base-worker, which sets `node: false`, so the copy of the Nuxt preset name check is not needed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chargome
approved these changes
Nov 10, 2026
chargome
marked this pull request as ready for review
November 10, 2026 15:05
s1gr1d
approved these changes
Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why: Nitro imports the server entry lazily, in the first request. Without
node --import, animport './instrument.server'inserver.tsrunsSentry.init()only after that request started, so every cold start loses itshttp.serverspan. This follows what@sentry/nuxtdoes since #24094: the Vite plugin findsinstrument.server.{ts,mts,js,mjs}(project root, thensrc/), bundles it into the Nitro build and loads it from a Nitro plugin, which runs when the server starts. Like Nuxt, this is always on and has no option. Orchestrion already instruments the drivers at build time, so--importis no longer needed in production. Invite devyou still need it.Existing setups keep working. A
--importpreload or an import inserver.tsnow runsinit()a second time. The first client wins, and the SDK logs that the preload or import can be removed (Nuxt logs the same).init()is also skipped while TanStack Start prerenders (TSS_PRERENDERING), which Nuxt does too. Otherwise the bundled config would send events from the build.The
tanstackstart-reacte2e app now starts without--import. The whole suite passes locally that way, including the ioredis and mysql spans.tanstackstart-react-statickeeps--import, so it covers existing start commands.How to review: Start with
src/vite/serverInstrumentation.ts, theninit()insrc/server/sdk.ts.Unsure about: The docs still tell people to copy
instrument.server.mjsand preload it, or to import it inserver.ts. They need a follow-up in sentry-docs, like the Nuxt migration note.Closes JS-4051
via Francesco Gringl-Novy.
--
View Session [Sentry]