René's URL Explorer Experiment


Title: NextJS Pages API Route traces are not continued from incoming trace · Issue #14787 · getsentry/sentry-javascript · GitHub

Open Graph Title: NextJS Pages API Route traces are not continued from incoming trace · Issue #14787 · getsentry/sentry-javascript

X Title: NextJS Pages API Route traces are not continued from incoming trace · Issue #14787 · 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/14787

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"NextJS Pages API Route traces are not continued from incoming trace","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.46.0\n\n### Framework Version\n\nNextJS 15.1.1\n\n### Link to Sentry event\n\nN/A\n\n### Reproduction Example/SDK Setup\n\nClone my repro: https://github.com/Lms24/nextjs-trace-envelope-header\n\n\n\n### Steps to Reproduce\n\nTo reproduce:\n\n1. `npm install`\n2. `npm run build && npm run start`\n3. `sh req.sh`\n\nObserve that trace_id, sample_rate and transaction fields (+others) are not continued from incoming trace (see `req.sh`). Meaning, it seems like the NextJS SDK starts a new trace for the server-side instead of continuing the passed trace via the headers. \n\n### Expected Result\n\n* The SDK continues the incoming trace, freezes the DSC values passed in via `baggage` \n* When sending its transaction event, the SDK puts the frozen DSC values into the `trace` envelope header and sends the continued trace data in `event.context.trace`\n\n### Actual Result\n\n* The SDK doesn't continue the incoming trace but seems to start a new trace \n* When sending its transaction event, SDK populates the DSC from the new trace and sends the new trace\n\n### Additional information\n\nThe logs suggest that there might be 2 ongoing root spans which possibly(?) conflict with each other?\n\n```\nSentry Logger [log]: [Tracing] Inheriting remote parent's sampled decision for GET /api/test: true\nSentry Logger [log]: [Tracing] Starting sampled root span\n  op: \u003c unknown op >\n  name: GET /api/test\n  ID: 6d6d1a6095cd996c\n  parent ID: 9a124d0d6c081115\nSentry Logger [log]: [Tracing] Inheriting parent's sampled decision for executing api route (pages) /api/test: true\nSentry Logger [log]: [Tracing] Starting sampled span\n  op: \u003c unknown op >\n  name: executing api route (pages) /api/test\n  ID: 134e7d6841094ac1\n  parent ID: 6d6d1a6095cd996c\n  root ID: 6d6d1a6095cd996c\n  root description: GET /api/test\nSentry Logger [info]: Starting a new trace with id 1f225918b9444512867b7f0fed977fa5\nSentry Logger [log]: [Tracing] Starting sampled root span\n  op: http.server\n  name: GET /api/test\n  ID: dfd3fc2e5a4b4818\nSentry Logger [log]: [Tracing] Finishing \"http.server\" root span \"GET /api/test\" with ID dfd3fc2e5a4b4818\nSentry Logger [log]: Flushing events...\nSentry Logger [log]: SpanExporter exported 1 spans, 0 spans are waiting for their parent spans to finish\nSentry Logger [log]: Flushing outcomes...\nSentry Logger [log]: No outcomes to send\nSentry Logger [log]: [Tracing] Finishing \"\u003c unknown op >\" span \"executing api route (pages) /api/test\" with ID 134e7d6841094ac1\nSentry Logger [log]: [Tracing] Finishing \"\u003c unknown op >\" root span \"GET /api/test\" with ID 6d6d1a6095cd996c\nSentry Logger [log]: SpanExporter exported 2 spans, 0 spans are waiting for their parent spans to finish\nevent trace context: {\n  span_id: 'dfd3fc2e5a4b4818',\n  trace_id: '2f656955b869439a0f839731c22cc4eb',\n  data: {\n    'sentry.source': 'route',\n    'sentry.sample_rate': 0.99,\n    'sentry.op': 'http.server',\n    'sentry.origin': 'auto.http.nextjs',\n    'http.response.status_code': 200\n  },\n  origin: 'auto.http.nextjs',\n  op: 'http.server',\n  status: 'ok'\n}\n{\n  envelopeTraceHeader: {\n    environment: 'production',\n    release: '0UzErXa-sfDtF-53wmU7x',\n    public_key: 'c64221a14c2b788162c7b81c2f94d65e',\n    trace_id: '2f656955b869439a0f839731c22cc4eb',\n    sample_rate: '0.99',\n    transaction: 'GET /api/test',\n    sampled: 'true'\n  }\n}\nSentry Logger [log]: Event processor \"NextLowQualityTransactionsFilter\" dropped event\nSentry Logger [log]: Recording outcome: \"event_processor:transaction\"\nSentry Logger [log]: An event processor returned `null`, will not send event.\nSentry Logger [log]: Done flushing events\n```","author":{"url":"https://github.com/Lms24","@type":"Person","name":"Lms24"},"datePublished":"2024-12-18T17:04:22Z","url":"https://github.com/getsentry/sentry-javascript/issues/14787"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:19aca9f6-e2ee-4fd1-6c48-f3794379e313
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCBB6:43FF1:2BC8482:38795CC:6B0406F1
html-safe-nonce62ed7d1f07dad2b694d410eb53ad00ef20f4b37985ede40c7992e5d41dfc65e1
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQkI2OjQzRkYxOjJCQzg0ODI6Mzg3OTVDQzo2QjA0MDZGMSIsInZpc2l0b3JfaWQiOiI3NDUyODExNTI5Mzg2NDYwOTEzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac8ca873d4fc89a831dcc2edb87906104c123da3aad5a70d0cd20ea13a2901f786
hovercard-subject-tagissue:2748335859
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/14787/issue_layout
twitter:imagehttps://opengraph.githubassets.com/fdd69e686231d85519a552d1140ec2823b2429cf54fc2dce79e50aa356fde4be/getsentry/sentry-javascript/issues/14787
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/fdd69e686231d85519a552d1140ec2823b2429cf54fc2dce79e50aa356fde4be/getsentry/sentry-javascript/issues/14787
og:image:altIs 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:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameLms24
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
go-importgithub.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git
octolytics-dimension-user_id1396951
octolytics-dimension-user_logingetsentry
octolytics-dimension-repository_id3328572
octolytics-dimension-repository_nwogetsentry/sentry-javascript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id3328572
octolytics-dimension-repository_network_root_nwogetsentry/sentry-javascript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/getsentry/sentry-javascript/issues/14787#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript%2Fissues%2F14787
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript%2Fissues%2F14787
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=getsentry%2Fsentry-javascript
Reloadhttps://github.com/getsentry/sentry-javascript/issues/14787
Reloadhttps://github.com/getsentry/sentry-javascript/issues/14787
Reloadhttps://github.com/getsentry/sentry-javascript/issues/14787
getsentryhttps://github.com/getsentry
sentry-javascripthttps://github.com/getsentry/sentry-javascript
Codehttps://github.com/getsentry/sentry-javascript
Issues342 (342)https://github.com/getsentry/sentry-javascript/issues
Pull requests60 (60)https://github.com/getsentry/sentry-javascript/pulls
Discussionshttps://github.com/getsentry/sentry-javascript/discussions
Actionshttps://github.com/getsentry/sentry-javascript/actions
Security and quality7 (7)https://github.com/getsentry/sentry-javascript/security
Insightshttps://github.com/getsentry/sentry-javascript/insights
https://github.com/getsentry/sentry-javascript
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/14787
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/14787
#14813https://github.com/getsentry/sentry-javascript/pull/14813
NextJS Pages API Route traces are not continued from incoming tracehttps://github.com/getsentry/sentry-javascript/issues/14787#top
#14813https://github.com/getsentry/sentry-javascript/pull/14813
https://github.com/chargome
Bughttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Bug%22
https://github.com/Lms24
Lms24https://github.com/Lms24
on Dec 18, 2024https://github.com/getsentry/sentry-javascript/issues/14787#issue-2748335859
https://github.com/getsentry/sentry-javascript/issueshttps://github.com/getsentry/sentry-javascript/issues
https://docs.sentry.io/https://docs.sentry.io/
https://github.com/getsentry/sentry-javascript/releaseshttps://github.com/getsentry/sentry-javascript/releases
https://github.com/Lms24/nextjs-trace-envelope-headerhttps://github.com/Lms24/nextjs-trace-envelope-header
github-actionshttps://github.com/apps/github-actions
Package: nextjshttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Package%3A%20nextjs%22
on Dec 18, 2024https://github.com/getsentry/sentry-javascript/issues/14787#event-15706489289
Lms24https://github.com/Lms24
chargomehttps://github.com/chargome
on Dec 18, 2024https://github.com/getsentry/sentry-javascript/issues/14787#event-15706490679
Lms24https://github.com/Lms24
on Dec 18, 2024https://github.com/getsentry/sentry-javascript/issues/14787#event-15706645198
https://github.com/chargome
chargomehttps://github.com/chargome
on Dec 19, 2024https://github.com/getsentry/sentry-javascript/issues/14787#issuecomment-2554553480
#14481https://github.com/getsentry/sentry-javascript/pull/14481
https://github.com/Lms24
Lms24https://github.com/Lms24
on Dec 20, 2024https://github.com/getsentry/sentry-javascript/issues/14787#issuecomment-2556505751
#14803https://github.com/getsentry/sentry-javascript/issues/14803
https://github.com/mydea
mydeahttps://github.com/mydea
on Dec 20, 2024https://github.com/getsentry/sentry-javascript/issues/14787#issuecomment-2556649447
https://github.com/lforst
lforsthttps://github.com/lforst
on Dec 20, 2024https://github.com/getsentry/sentry-javascript/issues/14787#issuecomment-2556693547
@mydeahttps://github.com/mydea
mydeahttps://github.com/mydea
completedhttps://github.com/getsentry/sentry-javascript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#14813https://github.com/getsentry/sentry-javascript/pull/14813
on Dec 20, 2024https://github.com/getsentry/sentry-javascript/issues/14787#event-15732676570
mydeahttps://github.com/mydea
completedhttps://github.com/getsentry/sentry-javascript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
65531f3https://github.com/getsentry/sentry-javascript/commit/65531f3426b2426eb06ac9cf9500c958e81652f4
on Dec 20, 2024https://github.com/getsentry/sentry-javascript/issues/14787#event-15732676597
s1gr1dhttps://github.com/s1gr1d
on Dec 20, 2024https://github.com/getsentry/sentry-javascript/issues/14787#event-15732833693
fix(v8/core): Use consistent `continueTrace` implementation in core (#…https://github.com/getsentry/sentry-javascript/commit/1f5013a19defb9e37c359e9f84cbfe4838ceec1a
#…https://github.com/getsentry/sentry-javascript/pull/14813
1f5013ahttps://github.com/getsentry/sentry-javascript/commit/1f5013a19defb9e37c359e9f84cbfe4838ceec1a
fix(v8/core): Use consistent `continueTrace` implementation in core (#…https://github.com/getsentry/sentry-javascript/commit/519af90284ff2b13071b3f2461cf895398c0e442
#…https://github.com/getsentry/sentry-javascript/pull/14813
519af90https://github.com/getsentry/sentry-javascript/commit/519af90284ff2b13071b3f2461cf895398c0e442
pullhttps://github.com/apps/pull
on Dec 20, 2024https://github.com/getsentry/sentry-javascript/issues/14787#event-15734836467
fix(core): Use consistent `continueTrace` implementation in core (get…https://github.com/Stars1233/sentry-javascript/commit/65531f3426b2426eb06ac9cf9500c958e81652f4
get…https://github.com/getsentry/sentry-javascript/pull/14813
65531f3https://github.com/Stars1233/sentry-javascript/commit/65531f3426b2426eb06ac9cf9500c958e81652f4
s1gr1dhttps://github.com/s1gr1d
on Dec 30, 2024https://github.com/getsentry/sentry-javascript/issues/14787#event-15784294214
fix(v8/core): Use consistent `continueTrace` implementation in core (#…https://github.com/getsentry/sentry-javascript/commit/576a1ad0f223173185e146422164fa1ec1689f77
#…https://github.com/getsentry/sentry-javascript/pull/14819
576a1adhttps://github.com/getsentry/sentry-javascript/commit/576a1ad0f223173185e146422164fa1ec1689f77
Bughttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Bug%22
on Aug 12, 2025https://github.com/getsentry/sentry-javascript/issues/14787#event-19124600196
Sign up for freehttps://github.com/signup?return_to=https://github.com/getsentry/sentry-javascript/issues/14787
Sign in to commenthttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/14787
chargomehttps://github.com/chargome
Bughttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.