Title: TanStack Start on Nitro: first request per server instance has no http.server span without --import · Issue #25970 · getsentry/sentry-javascript · GitHub
Open Graph Title: TanStack Start on Nitro: first request per server instance has no http.server span without --import · Issue #25970 · getsentry/sentry-javascript
X Title: TanStack Start on Nitro: first request per server instance has no http.server span without --import · Issue #25970 · getsentry/sentry-javascript
Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using the latest SDK release https://github.com/...
Open Graph Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
X Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/25970
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TanStack Start on Nitro: first request per server instance has no http.server span without --import","articleBody":"### Is there an existing issue for this?\n\n- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\n- [x] I have reviewed the documentation https://docs.sentry.io/\n- [x] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\n\n### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Which SDK are you using?\n\n`@sentry/tanstackstart-react`\n\n### SDK Version\n\n11.10.0\n\n### Framework Version\n\n`@tanstack/react-start` 1.168.60, `nitro` 3.0.260903-beta\n\n### Reproduction Example/SDK Setup\n\nOn hosts where `node --import` isn't available, such as Vercel, [#19458](https://github.com/getsentry/sentry-javascript/issues/19458#issuecomment-3953443714) recommends importing the instrumentation first in `server.ts`:\n\n```ts\n// src/server.ts\nimport './instrument.server';\nimport { wrapFetchWithSentry } from '@sentry/tanstackstart-react';\nimport handler, { createServerEntry } from '@tanstack/react-start/server-entry';\n\nexport default createServerEntry(\n wrapFetchWithSentry({\n fetch(request: Request) {\n return handler.fetch(request);\n },\n }),\n);\n```\n\n```ts\n// src/instrument.server.ts\nimport * as Sentry from '@sentry/tanstackstart-react';\n\nSentry.init({ dsn: '...', tracesSampleRate: 1, debug: true });\nconsole.log('[sentry] init');\n```\n\nThe app is your `tanstackstart-react` e2e test app, cut down to `__root` and `index`, using the `nitro()` and `sentryTanstackStart()` Vite plugins.\n\n### Steps to Reproduce\n\n1. Run `vite build`.\n2. Run `node .output/server/index.mjs`, without `--import`.\n3. Request `/` twice.\n\n### Expected Result\n\nBoth requests produce an `http.server` root span.\n\n### Actual Result\n\n`[sentry] init` isn't printed at startup. It's printed when the first request arrives, so the HTTP instrumentation misses that request:\n\n```text\nListening on: http://localhost:3107/\n# first request\n[sentry] init\n[Tracing] Starting sampled root span\n op: middleware\n name: globalRequestMiddleware\nSending span envelope for trace e4ef... with 1 spans\n# second request\nHttp.Server Handling incoming request\n[Tracing] Starting sampled root span\n op: http.server\n name: GET\n[Tracing] Starting sampled span\n op: middleware\n name: globalRequestMiddleware\nSending span envelope for trace aa6e... with 2 spans\n```\n\n### Additional Context\n\nNitro loads the server entry lazily, so `server.ts` first runs inside the first request:\n\n```js\n// .output/server/index.mjs\nvar _lazy = defineLazyEventHandler(() => import(\"./_chunks/ssr-renderer.mjs\"));\n```\n\nOn serverless hosts this repeats for every new instance, so the requests with no trace are the cold starts. We see about 2,000 a day on a Vercel staging deployment (measured on SDK 11.9.0).\n\nWe tried calling `Sentry.init` from a Nitro plugin, which runs at startup. The plugin bundled a second copy of the SDK that never received the route names, so route naming broke and we reverted it. A supported way to initialise from a Nitro plugin, or to have the Vite plugin do it, would fix this.\n\nThis was written by Opus 5.5.\n","author":{"url":"https://github.com/ryanhiizy","@type":"Person","name":"ryanhiizy"},"datePublished":"2026-10-31T06:25:21Z","url":"https://github.com/getsentry/sentry-javascript/issues/25970"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:afe93930-8f15-5cd9-a6e4-96397637da5f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C2F2:1AAEE4:71F388:9AE0B0:6B04447D |
| html-safe-nonce | 0d0a4531a6e2ca657251c7121f7f747789d4eb9350daad08fe26ab933addcd70 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMkYyOjFBQUVFNDo3MUYzODg6OUFFMEIwOjZCMDQ0NDdEIiwidmlzaXRvcl9pZCI6IjE3NjA1NzIwNzkyODEwMzAyNzAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3469a15c4e11ce120db9f8e0428619b2a67c6e980e72f97934fd1839b5817152 |
| hovercard-subject-tag | issue:6131952335 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/25970/issue_layout |
| twitter:image | https://opengraph.githubassets.com/01561f7dda2e53c3e8e02982cccafaced46216db9a79d41c194f26d5d4761df1/getsentry/sentry-javascript/issues/25970 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/01561f7dda2e53c3e8e02982cccafaced46216db9a79d41c194f26d5d4761df1/getsentry/sentry-javascript/issues/25970 |
| og:image:alt | Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ryanhiizy |
| hostname | github.com |
| expected-hostname | github.com |
| None | d4495c3631faba668036f176d1f5946901c5172efd73a6edb984029e7d4f8e46 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9ac4337fb7c6a5846cdfdb1a04f154d3c33ebc77 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width