Skip to content

test(nextjs): Cover the trace hand-off of a proxy that runs on its own - #27087

Draft
chargome wants to merge 2 commits into
feat/nextjs-proxy-render-trace-linkfrom
test/nextjs-adapter-proxy-render-trace
Draft

chargome wants to merge 2 commits into
feat/nextjs-proxy-render-trace-linkfrom
test/nextjs-adapter-proxy-render-trace

Conversation

@chargome

@chargome chargome commented Dec 2, 2026

Copy link
Copy Markdown
Member

What

The nextjs-16-adapter e2e app now runs the proxy and the render in processes of their own, like Vercel,
and checks that the render continues the proxy's trace, with and without an incoming trace.

Why

next start runs proxy and render in one process, so it does not cover the headers Next.js passes between
them when the proxy runs on its own. A real Vercel deployment would cover that too, but we keep it out of CI.

Ref: #26980

@chargome chargome self-assigned this Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: c3591f8 (PR test merge using base PR #27086 at 990c723)

Against: 990c723 (base PR #27086) · base run #68591

✅ Baseline matches: this diff contains only this PR's changes.

Path Size % Change Change
@sentry/browser 30.64 kB - -
@sentry/browser - with treeshaking flags 28.73 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.62 kB - -
@sentry/browser (incl. Tracing) 53.98 kB - -
@sentry/browser (incl. Tracing Core) 40.82 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 53.98 kB - -
@sentry/browser (incl. Tracing, Profiling) 56.86 kB - -
@sentry/browser (incl. Tracing, Replay) 93.96 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 82.52 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 98.8 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 111.75 kB - -
@sentry/browser (incl. Feedback) 48.51 kB - -
@sentry/browser (incl. sendFeedback) 31.2 kB - -
@sentry/browser (incl. FeedbackAsync) 36.26 kB - -
@sentry/browser (incl. Metrics) 31.96 kB - -
@sentry/browser (incl. Logs) 32.25 kB - -
@sentry/browser (incl. Metrics & Logs) 32.91 kB - -
@sentry/react 32.5 kB - -
@sentry/react (incl. Tracing) 56.46 kB - -
@sentry/vue 38.99 kB - -
@sentry/vue (incl. Tracing) 57.05 kB - -
@sentry/svelte 30.68 kB - -
@sentry/effect (client) 42.21 kB - -
@sentry/effect (client, incl. Tracing) 55.02 kB - -
@sentry/effect (client, incl. Tracing, Logs, Metrics) 66.5 kB - -
@sentry/remix (Remix 3 client bundle) 59.47 kB - -
CDN Bundle 32.45 kB - -
CDN Bundle (incl. Tracing) 54.12 kB - -
CDN Bundle (incl. Logs, Metrics) 35.2 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 56.57 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 76.15 kB - -
CDN Bundle (incl. Tracing, Replay) 91.93 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 94.44 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 97.38 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.85 kB - -
CDN Bundle - uncompressed 94.67 kB - -
CDN Bundle (incl. Tracing) - uncompressed 160.02 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 103.01 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 167.65 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 233.4 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 280.45 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 288.08 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 292.39 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 300 kB - -
@sentry/nextjs (client) 59.75 kB - -
@sentry/sveltekit (client) 54.8 kB - -
@sentry/astro (client) - rolldown, without tracing 35.73 kB +0.01% +1 B 🔺
@sentry/core/server 45.91 kB - -
@sentry/core/browser 14.55 kB - -
@sentry/node 157.66 kB -0.01% -1 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.63 kB - -
@sentry/node - without tracing 89.66 kB - -
@sentry/node - without channel injection 146.99 kB - -
@sentry/aws-serverless 100.57 kB - -
@sentry/cloudflare (withSentry) - minified 212.87 kB - -
@sentry/cloudflare (withSentry) 493.43 kB - -
@sentry/cloudflare (withSentry, instrumented CommonJS package) - minified 215.81 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 241.03 kB - -

View base workflow run

@chargome
chargome added this pull request to stack #27088 December 2, 2026 15:43
Runs the proxy and the render of the adapter app in processes of their
own, as on Vercel, so the test covers the hand-off in the `traceparent`
and `tracestate` request headers.

Refs #26980
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chargome
chargome force-pushed the test/nextjs-adapter-proxy-render-trace branch from aec1c26 to 0f32147 Compare December 2, 2026 15:49
Comment on lines +89 to +101
function getRenderRequestHeaders(incomingHeaders, proxyResponseHeaders) {
const overrides = proxyResponseHeaders['x-middleware-override-headers'];
if (!overrides) {
return incomingHeaders;
}
const headers = {};
for (const key of overrides.split(',').map(key => key.trim())) {
const value = proxyResponseHeaders[`x-middleware-request-${key}`];
if (value !== undefined) {
headers[key] = value;
}
}
return headers;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Incoming-trace e2e expects render parent to be remote parent, not proxy span

tests/proxy-render-trace.test.ts asserts the render segment’s parent_span_id stays 1121201211212012 when an incoming sentry-trace is present. With the harness applying proxy hand-off headers (traceparent/tracestate), the render must parent to proxySegment.span_id (as the first e2e test and NextSentryPropagator unit tests require), so this assertion fails under correct hand-off behavior.

Evidence
  • server.mjs getRenderRequestHeaders() rebuilds the render request from x-middleware-request-*, which is how Next hands traceparent/tracestate from the proxy process to the render.
  • NextSentryPropagator.extract() prefers extractTraceHandOff(traceparent, tracestate) over an incoming sentry-trace, and unit tests assert the render’s parent is the hand-off span id.
  • The first e2e case already expects renderSegment.parent_span_id === proxySegment.span_id.
  • The second e2e case still expects both proxy and render segments to use parent 1121201211212012, which contradicts that hand-off contract once override headers are applied.

Identified by Warden · code-review · R5S-EED

@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

Some optional checks were not successful. They do not block the merge. 1 not successful, 64 successful. See the run.

Check Status
❌ CI: Optional E2E Tests / E2E node-express-mcp-v2 (MCP SDK OpenTelemetry) Test (optional) Failing after 1m Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-send-to-sentry Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (cloudflare) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E hono-5 (bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E astro-7 (static trace lifecycle) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-without-tracing-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E deno (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E cloudflare-think (ai v6) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-4-sourcemaps (Vite server) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-agent Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (development) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E hapi-21 (deno) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 4m Details
✅ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (bun) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps (manual upload) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E hono-5 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E hapi-21 (bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E react-send-to-sentry Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps (no upload) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-flue-send-to-sentry Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 (no upload) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel (cloudflare) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solidstart-2-tunnel Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-eve (content off) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-eve (0.x) 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-tunnel (cloudflare) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps (delete all) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 (manual upload) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E hono-5 (cloudflare) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-14-supabase Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E debug-id-sourcemaps Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps enabled by Sentry) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry (static trace lifecycle) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E vinext-cf-workers (workers cache) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-mastra (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v1 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry 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 node-eve (orchestrion) Test (optional) Successful in 4m Details
✅ CI: Optional E2E Tests / E2E node-flue (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-pi-durable (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (no upload) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E hono-5 (deno) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (deno) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (kv-cache) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E vue-3 (no Options API) Test (optional) Successful in 1m Details

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