Skip to content

fix(nextjs): Don't abort Cache Components renders on Cloudflare Workers when requests overlap - #25315

Draft
chargome wants to merge 1 commit into
developfrom
js-3906-continue-work
Draft

chargome wants to merge 1 commit into
developfrom
js-3906-continue-work

Conversation

@chargome

Copy link
Copy Markdown
Member

What

The SDK's safe ID generation now exits the Next.js work-unit storage that Next.js 16.4 and newer register on globalThis, and only falls back to an AsyncLocalStorage snapshot on older versions. @sentry/core no longer caches a missing runner, so a runner registered after the first random value is picked up. Adds an optional OpenNext e2e variant for the Cache Components app with a spec for overlapping runtime prefetches.

Why

On Cloudflare Workers, overlapping Cache Components requests ended with one of them aborted and a ~ body. workerd binds snapshots to the request that took them, so the SDK re-snapshotted inside another request's prerender and tripped the Next.js sync-IO guard. The Worker also holds a second copy of core via withSentry that generated its first ID before Next.js was loaded and never saw the runner.

The e2e variant is optional because released OpenNext cannot run Next.js 16.4 yet (opennextjs/opennextjs-cloudflare#1448). Verified locally against their preview builds.

Fixes #25245

…rs when requests overlap

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@chargome chargome self-assigned this Oct 13, 2026
@linear-code

linear-code Bot commented Oct 13, 2026

Copy link
Copy Markdown

JS-3906

@chargome

Copy link
Copy Markdown
Member Author

bugbot run

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.81 kB -0.06% -17 B 🔽
@sentry/browser - with treeshaking flags 27.94 kB -0.08% -20 B 🔽
@sentry/browser - with treeshaking flags tracing without tracing 27.85 kB -0.08% -20 B 🔽
@sentry/browser (incl. Tracing) 52 kB -0.03% -14 B 🔽
@sentry/browser (incl. Tracing + Span Streaming) 52.01 kB -0.03% -15 B 🔽
@sentry/browser (incl. Tracing, Profiling) 54.95 kB -0.03% -14 B 🔽
@sentry/browser (incl. Tracing, Replay) 91.73 kB -0.02% -14 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.6 kB -0.03% -17 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 96.46 kB -0.02% -15 B 🔽
@sentry/browser (incl. Tracing, Replay, Feedback) 109.42 kB -0.02% -15 B 🔽
@sentry/browser (incl. Feedback) 47.33 kB -0.05% -20 B 🔽
@sentry/browser (incl. sendFeedback) 34.87 kB -0.06% -19 B 🔽
@sentry/browser (incl. FeedbackAsync) 39.98 kB -0.05% -19 B 🔽
@sentry/browser (incl. Metrics) 30.83 kB -0.06% -18 B 🔽
@sentry/browser (incl. Logs) 31.11 kB -0.07% -19 B 🔽
@sentry/browser (incl. Metrics & Logs) 31.76 kB -0.06% -18 B 🔽
@sentry/react 31.63 kB -0.06% -18 B 🔽
@sentry/react (incl. Tracing) 54.33 kB -0.04% -17 B 🔽
@sentry/vue 37.96 kB -0.05% -16 B 🔽
@sentry/vue (incl. Tracing) 54.93 kB -0.03% -15 B 🔽
@sentry/svelte 29.84 kB -0.07% -18 B 🔽
@sentry/remix (Remix 3 client bundle) 57 kB -0.04% -18 B 🔽
CDN Bundle 31.54 kB -0.07% -19 B 🔽
CDN Bundle (incl. Tracing) 52.5 kB -0.04% -16 B 🔽
CDN Bundle (incl. Logs, Metrics) 33.75 kB -0.06% -17 B 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) 54.44 kB -0.04% -18 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) 74.68 kB -0.03% -22 B 🔽
CDN Bundle (incl. Tracing, Replay) 90.17 kB -0.03% -19 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 92.09 kB -0.02% -18 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 96.32 kB -0.02% -17 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.26 kB -0.03% -22 B 🔽
CDN Bundle - uncompressed 92.94 kB -0.05% -40 B 🔽
CDN Bundle (incl. Tracing) - uncompressed 155.79 kB -0.03% -40 B 🔽
CDN Bundle (incl. Logs, Metrics) - uncompressed 99.48 kB -0.05% -40 B 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 161.75 kB -0.03% -40 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 229.52 kB -0.02% -40 B 🔽
CDN Bundle (incl. Tracing, Replay) - uncompressed 275.96 kB -0.02% -40 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 281.9 kB -0.02% -40 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 289.66 kB -0.02% -40 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 295.6 kB -0.02% -40 B 🔽
@sentry/nextjs (client) 56.73 kB -0.04% -21 B 🔽
@sentry/sveltekit (client) 52.39 kB -0.04% -16 B 🔽
@sentry/core/server 40.98 kB -0.04% -13 B 🔽
@sentry/core/browser 13.8 kB -0.08% -11 B 🔽
@sentry/node 151.95 kB -0.01% -8 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.77 kB -0.02% -13 B 🔽
@sentry/node - without tracing 94.52 kB -0.02% -11 B 🔽
@sentry/node - without channel injection 130.13 kB -0.01% -6 B 🔽
@sentry/aws-serverless 102.69 kB -0.01% -1 B 🔽
@sentry/cloudflare (withSentry) - minified 210.34 kB -0.02% -42 B 🔽
@sentry/cloudflare (withSentry) 521.52 kB -0.02% -88 B 🔽
@sentry/nextjs/cloudflare (withSentry) - minified 228.01 kB -0.02% -42 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.

✅ 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 51650f3. Configure here.

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.

@sentry/nextjs aborts Next.js Cache Components renders on Cloudflare Workers when requests overlap

1 participant