Title: Send trace context in the Server-Timing header for self-hosted Next.js · Issue #24945 · getsentry/sentry-javascript · GitHub
Open Graph Title: Send trace context in the Server-Timing header for self-hosted Next.js · Issue #24945 · getsentry/sentry-javascript
X Title: Send trace context in the Server-Timing header for self-hosted Next.js · Issue #24945 · getsentry/sentry-javascript
Description: Meta tags inside the HTML have a timing problem: the browser SDK may start before the tag has arrived. HTTP response headers do not have that problem. They are sent before any HTML, and the browser SDK already reads a Server-Timing heade...
Open Graph Description: Meta tags inside the HTML have a timing problem: the browser SDK may start before the tag has arrived. HTTP response headers do not have that problem. They are sent before any HTML, and the browser...
X Description: Meta tags inside the HTML have a timing problem: the browser SDK may start before the tag has arrived. HTTP response headers do not have that problem. They are sent before any HTML, and the browser...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/24945
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Send trace context in the Server-Timing header for self-hosted Next.js","articleBody":"Meta tags inside the HTML have a timing problem: the browser SDK may start before the tag has arrived. HTTP response headers do not have that problem. They are sent before any HTML, and the browser SDK already reads a `Server-Timing` header to find the trace (added in #18673). Our Remix and Nitro SDKs already write this header. Next.js does not.\n\nFor a self-hosted Next.js app, `next start` sends the response headers at the moment the first piece of HTML is written. That happens inside the server request's span, so the correct trace is known at that point.\u003cbr>\n\n* packages/node: add a small hook to the http integration that is called with the request and response for every incoming request, also when incoming request spans are disabled. It does nothing on its own.\n* packages/nextjs server `init`: use that hook to set the header right before the response headers are sent:\n\n ```\n Server-Timing: sentry-trace;desc=\"\u003ctrace>\", baggage;desc=\"\u003cbaggage>\"\n ```\n* Reuse the header formatting that Remix already has in `serverTimingTracePropagation.ts` by moving it to `@sentry/core`.\n* Do not add the header twice if the app already set one that contains `sentry-trace`.\n\nTests\n\n* E2E in the cacheComponents app: a page with `export const instant = false` connects the pageload to the server trace through the header.\u003cbr>\u003cbr>\u003cbr>Handling on Vercel is a separate issue.","author":{"url":"https://github.com/chargome","@type":"Person","name":"chargome"},"datePublished":"2026-10-01T13:40:08Z","url":"https://github.com/getsentry/sentry-javascript/issues/24945"}
| 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:c74ffb3c-0703-f499-cdce-336d0ac2423e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8798:18D8CC:21BAC88:2C01DC7:6B04148D |
| html-safe-nonce | 3dd1f0d27a621f5a0b49a3e68649a493d08827e4d9b718eb4331806e98d9c017 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Nzk4OjE4RDhDQzoyMUJBQzg4OjJDMDFEQzc6NkIwNDE0OEQiLCJ2aXNpdG9yX2lkIjoiMTgwMjYxMDcwMzc3ODE5MDQ3NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c4605ee9a9f1db66afecd75d1b19261726eeac4f51398344fe4ce2ff35ab8c37 |
| hovercard-subject-tag | issue:5663104512 |
| 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/24945/issue_layout |
| twitter:image | https://opengraph.githubassets.com/198dc9c4ba1104263a6df3bccb27945ecc0acb814794b29a4073b23ef3c65d5c/getsentry/sentry-javascript/issues/24945 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/198dc9c4ba1104263a6df3bccb27945ecc0acb814794b29a4073b23ef3c65d5c/getsentry/sentry-javascript/issues/24945 |
| og:image:alt | Meta tags inside the HTML have a timing problem: the browser SDK may start before the tag has arrived. HTTP response headers do not have that problem. They are sent before any HTML, and the browser... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | chargome |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | canary-2 |
| 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