Title: Multiple trace IDs generated in sentry-trace header when using Next.js · Issue #13870 · getsentry/sentry-javascript · GitHub
Open Graph Title: Multiple trace IDs generated in sentry-trace header when using Next.js · Issue #13870 · getsentry/sentry-javascript
X Title: Multiple trace IDs generated in sentry-trace header when using Next.js · Issue #13870 · 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/13870
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Multiple trace IDs generated in sentry-trace header when using Next.js","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/nextjs\n\n### SDK Version\n\n8.33.1\n\n### Framework Version\n\nNext 14.2.14\n\n### Link to Sentry event\n\nn/a\n\n### Reproduction Example/SDK Setup\n\nDependencies\n```json\n{\n \"dependencies\": {\n \"@next/third-parties\": \"^14.2.14\",\n \"@nextui-org/react\": \"2.4.2\",\n \"@nextui-org/use-infinite-scroll\": \"^2.1.5\",\n \"@nimpl/middleware-chain\": \"^0.4.0\",\n \"@sentry/nextjs\": \"^8.33.1\",\n \"caniuse-lite\": \"^1.0.30001667\",\n \"clsx\": \"^2.1.1\",\n \"dayjs\": \"^1.11.13\",\n \"framer-motion\": \"^11.11.0\",\n \"intl-locale-textinfo-polyfill\": \"^2.1.1\",\n \"negotiator\": \"^0.6.3\",\n \"next\": \"^14.2.14\",\n \"next-mdx-remote\": \"^5.0.0\",\n \"next-seo\": \"^6.6.0\",\n \"react\": \"^18.3.1\",\n \"react-dom\": \"^18.3.1\",\n \"react-hook-form\": \"^7.53.0\",\n \"sharp\": \"^0.33.5\",\n \"swr\": \"^2.2.5\",\n \"uuid\": \"^10.0.0\"\n },\n \"devDependencies\": {\n \"@next/bundle-analyzer\": \"^14.2.14\",\n \"@svgr/webpack\": \"^8.1.0\",\n \"@trivago/prettier-plugin-sort-imports\": \"^4.3.0\",\n \"@types/node\": \"^22.7.4\",\n \"@types/react\": \"^18.3.11\",\n \"@types/react-dom\": \"^18.3.0\",\n \"@types/uuid\": \"^10.0.0\",\n \"autoprefixer\": \"^10.4.20\",\n \"cssnano\": \"^7.0.6\",\n \"cssnano-preset-advanced\": \"^7.0.6\",\n \"eslint\": \"^8.57.1\",\n \"eslint-config-next\": \"^14.2.14\",\n \"postcss\": \"^8.4.47\",\n \"prettier\": \"^3.3.3\",\n \"prettier-plugin-tailwindcss\": \"^0.6.8\",\n \"tailwindcss\": \"^3.4.13\",\n \"typescript\": \"^5.6.2\"\n }\n}\n```\n\nsentry.client.config.ts\n```typescript\nimport * as Sentry from '@sentry/nextjs';\n\nimport { API_BASE_URL, APP_BASE_URL, ENVIRONMENT, RELEASE, SENTRY_DSN, SENTRY_TRACES_SAMPLE_RATE } from '@/config';\n\nSentry.init({\n dsn: SENTRY_DSN,\n release: RELEASE,\n environment: ENVIRONMENT,\n tracesSampleRate: SENTRY_TRACES_SAMPLE_RATE,\n tracePropagationTargets: [APP_BASE_URL, API_BASE_URL],\n integrations: [Sentry.browserTracingIntegration()],\n});\n```\n\ninstrumentation.ts\n```typescript\nimport * as Sentry from '@sentry/nextjs';\n\nimport { API_BASE_URL, ENVIRONMENT, RELEASE, SENTRY_DSN, SENTRY_TRACES_SAMPLE_RATE } from '@/config';\n\nexport async function register() {\n Sentry.init({\n dsn: SENTRY_DSN,\n release: RELEASE,\n environment: ENVIRONMENT,\n tracesSampleRate: SENTRY_TRACES_SAMPLE_RATE,\n tracePropagationTargets: [API_BASE_URL],\n });\n}\n\nexport const onRequestError = Sentry.captureRequestError;\n```\n\n### Steps to Reproduce\n\n1. Enable `tracePropagationTargets` and configure it to point to your backend server.\n2. Make HTTP requests using `fetch` inside middleware or during SSG generation in a Next.js project.\n3. When performing an HTTP request, Sentry will add the `Baggage` and `Sentry-Trace` headers to the outgoing requests.\n4. These headers will be received by the backend (using sentry-go).\n5. The `Sentry-Trace` header will contain two trace IDs, for example: \n`0b7da23d63cc4a7d9436abf37ace0e0c-9510fafae5f1c2c5-1,faca5d26f53d660657d9e4b073fb8da2-74dbb120f6aca02a-1`\n6. Due to the presence of two trace IDs, the backend cannot correctly parse the Parent Span ID, leading to incorrect transaction linking.\n\n\n\n### Expected Result\n\nThe `Sentry-Trace` header should contain only a single trace ID.\n\n### Actual Result\n\nThe `Sentry-Trace` header contains multiple trace IDs.\n\n","author":{"url":"https://github.com/shlyamster","@type":"Person","name":"shlyamster"},"datePublished":"2024-10-04T14:49:24Z","url":"https://github.com/getsentry/sentry-javascript/issues/13870"}
| 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:76dd7a7a-46bc-241e-7bd6-0711a86c1657 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D02A:2E3BF6:92E9D:C72F1:6B073674 |
| html-safe-nonce | 306c572fb784713fa9348976734d48789b0036dd57c26615d359ded65e664d08 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMDJBOjJFM0JGNjo5MkU5RDpDNzJGMTo2QjA3MzY3NCIsInZpc2l0b3JfaWQiOiI0MjY0NDc4MzA4NTA4ODQxNTg4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | fb994a1223bb66fe1232e5bfbddc77509e0684976f9174d04f59e20bc7382b61 |
| hovercard-subject-tag | issue:2566567262 |
| 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/13870/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6ea1b007f2f2a8f6dec4260481047871b2eeacaa4a8d6d99063a9123d31d192e/getsentry/sentry-javascript/issues/13870 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6ea1b007f2f2a8f6dec4260481047871b2eeacaa4a8d6d99063a9123d31d192e/getsentry/sentry-javascript/issues/13870 |
| 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 | shlyamster |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2a60952cad7efb2604ea85e500208f51c1ec1943aa260ac605c13eb46a1ed83b |
| 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 | 345c27626db08417fdfc84278a4415ae9a48d8f3 |
| 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