Skip to content

feat(nextjs): Continue injected trace meta tags in Pages Router pageloads - #26927

Open
chargome wants to merge 6 commits into
test/nextjs-16-pages-router-e2efrom
feat/nextjs-pages-router-injected-trace-meta-tags
Open

chargome wants to merge 6 commits into
test/nextjs-16-pages-router-e2efrom
feat/nextjs-pages-router-injected-trace-meta-tags

Conversation

@chargome

Copy link
Copy Markdown
Member

What

A Pages Router pageload now continues sentry-trace and baggage meta tags that belong to another trace than the server request, for example tags a mobile SDK injects into a WebView.

Why

The pageload always continued the server trace, so a WebView could not continue the trace of the app around it.

Next.js 15 and later render the server trace into the same meta tags, so a tag only counts as injected when its trace ID differs from the server's. The server's trace ID comes from __NEXT_DATA__, or from the Server-Timing header for Turbopack builds, which don't wrap data fetchers. The tag also needs a baggage tag for the same trace, so the baggage of the server trace is never mixed in.

Documents without such a tag behave as before. With an injected tag, the pageload follows the sampling decision of that trace and is no longer linked to the server span. On a Turbopack build whose host sends no Server-Timing header, there is nothing to compare against and the first tag in the document still wins.

Stacked on #26924.

…oads

A mobile SDK can inject `sentry-trace` and `baggage` meta tags into the
document of a WebView. The Pages Router pageload ignored them and continued
the server trace. It now continues a meta tag that belongs to another trace
than the server request, and keeps the previous behavior in every other case.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@chargome chargome self-assigned this Nov 26, 2026
@chargome

Copy link
Copy Markdown
Member Author

bugbot run

@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: 14f2a82 (PR test merge using develop at 6df7a32)

Against: a12f1aa (develop) · base run #68171

⚠️ Baseline mismatch: 3 develop commit(s) in the PR build are missing from the baseline; 10 develop commit(s) in the baseline are missing from the PR build. Their size changes also affect this comparison. Compare commits. Rebase your PR onto the latest develop to compare against an up-to-date baseline.

Path Size % Change Change
@sentry/browser 30.54 kB -0.05% -15 B 🔽
@sentry/browser - with treeshaking flags 28.73 kB -0.05% -14 B 🔽
@sentry/browser - with treeshaking flags tracing without tracing 28.6 kB -0.05% -14 B 🔽
@sentry/browser (incl. Tracing) 53.66 kB -0.04% -18 B 🔽
@sentry/browser (incl. Tracing Core) 40.58 kB -0.04% -15 B 🔽
@sentry/browser (incl. Tracing + Span Streaming) 53.66 kB -0.04% -17 B 🔽
@sentry/browser (incl. Tracing, Profiling) 56.56 kB -0.03% -15 B 🔽
@sentry/browser (incl. Tracing, Replay) 93.59 kB -0.02% -11 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 82.38 kB -0.03% -17 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 98.45 kB -0.02% -12 B 🔽
@sentry/browser (incl. Tracing, Replay, Feedback) 111.39 kB -0.02% -15 B 🔽
@sentry/browser (incl. Feedback) 48.4 kB -0.03% -12 B 🔽
@sentry/browser (incl. sendFeedback) 31.11 kB -0.05% -15 B 🔽
@sentry/browser (incl. FeedbackAsync) 36.16 kB -0.05% -17 B 🔽
@sentry/browser (incl. Metrics) 31.86 kB -0.05% -14 B 🔽
@sentry/browser (incl. Logs) 32.13 kB -0.05% -13 B 🔽
@sentry/browser (incl. Metrics & Logs) 32.8 kB -0.05% -15 B 🔽
@sentry/react 32.56 kB -0.05% -16 B 🔽
@sentry/react (incl. Tracing) 56.37 kB -0.09% -50 B 🔽
@sentry/vue 38.74 kB -0.05% -18 B 🔽
@sentry/vue (incl. Tracing) 56.67 kB -0.04% -18 B 🔽
@sentry/svelte 30.57 kB -0.05% -14 B 🔽
@sentry/effect (client) 42.22 kB -0.04% -16 B 🔽
@sentry/effect (client, incl. Tracing) 54.96 kB -0.03% -14 B 🔽
@sentry/effect (client, incl. Tracing, Logs, Metrics) 66.31 kB -0.02% -13 B 🔽
@sentry/remix (Remix 3 client bundle) 59.39 kB -0.05% -25 B 🔽
CDN Bundle 32.38 kB -0.05% -15 B 🔽
CDN Bundle (incl. Tracing) 54.04 kB -0.03% -16 B 🔽
CDN Bundle (incl. Logs, Metrics) 35.13 kB -0.04% -14 B 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) 56.5 kB -0.03% -16 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) 76.08 kB -0.03% -17 B 🔽
CDN Bundle (incl. Tracing, Replay) 91.84 kB -0.02% -14 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 94.37 kB -0.02% -12 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 97.31 kB -0.02% -19 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.78 kB -0.02% -14 B 🔽
CDN Bundle - uncompressed 94.56 kB -0.03% -24 B 🔽
CDN Bundle (incl. Tracing) - uncompressed 159.84 kB -0.02% -25 B 🔽
CDN Bundle (incl. Logs, Metrics) - uncompressed 102.9 kB -0.03% -24 B 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 167.47 kB -0.02% -25 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 233.29 kB -0.02% -25 B 🔽
CDN Bundle (incl. Tracing, Replay) - uncompressed 280.28 kB -0.01% -25 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 287.9 kB -0.01% -25 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 292.21 kB -0.01% -25 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 299.83 kB -0.01% -25 B 🔽
@sentry/nextjs (client) 60.21 kB +0.19% +114 B 🔺
@sentry/sveltekit (client) 55.02 kB -0.04% -18 B 🔽
@sentry/core/server 45.83 kB -0.04% -18 B 🔽
@sentry/core/browser 14.46 kB -0.12% -17 B 🔽
@sentry/node 157.38 kB -0.02% -23 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.45 kB - -
@sentry/node - without tracing 89.79 kB -0.03% -21 B 🔽
@sentry/node - without channel injection 146.35 kB -0.02% -18 B 🔽
@sentry/aws-serverless 100.42 kB -0.02% -18 B 🔽
@sentry/cloudflare (withSentry) - minified 211.94 kB -0.02% -38 B 🔽
@sentry/cloudflare (withSentry) 491.72 kB -0.02% -66 B 🔽
@sentry/cloudflare (withSentry, instrumented CommonJS package) - minified 214.88 kB -0.02% -38 B 🔽
@sentry/nextjs/cloudflare (withSentry) - minified 237.18 kB -0.02% -38 B 🔽

View base workflow run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

Some optional checks were not successful. They do not block the merge. 6 not successful, 12 successful. See the run.

Check Status
❌ CI: Optional E2E Tests / E2E nuxt-5 (kv-cache) Test (optional) Failing after 1m Details
❌ CI: Optional E2E Tests / E2E nuxt-5 (development) Test (optional) Failing after 2m Details
❌ CI: Optional E2E Tests / E2E nuxt-5 (bun) Test (optional) Failing after 1m Details
❌ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Failing after 1m Details
❌ CI: Optional E2E Tests / E2E nuxt-5 (cloudflare) Test (optional) Failing after 1m Details
❌ CI: Optional E2E Tests / E2E nuxt-5 (deno) Test (optional) Failing after 1m Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E nextjs-14-supabase Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 (manual upload) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 (delete all) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 (no upload) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E vinext-cf-workers (workers cache) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solidstart-2-tunnel Test (optional) Successful in 1m Details

… meta tag tests

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@chargome

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

…2E tests

Chrome denies a document that Playwright fulfills the requests to the event
proxy on localhost, so the pageload span never arrived.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@chargome

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@chargome
chargome added this pull request to stack #26932 November 26, 2026 13:29
@chargome
chargome marked this pull request as ready for review November 26, 2026 14:02
chargome and others added 2 commits November 26, 2026 15:04
…emporary)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…(temporary)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@chargome
chargome marked this pull request as draft November 26, 2026 14:11
Another test loads the same page in a parallel worker, and its pageload span
matched this test's wait. Also removes the temporary logging.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@chargome

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 3e59e9e. Configure here.

@chargome
chargome marked this pull request as ready for review November 26, 2026 14:46

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant