Skip to content

fix(v10/nextjs): Don't crash Cloudflare workers on import of the Next.js version helper - #25730

Merged
logaretm merged 1 commit into
v10from
awad/js-3994-sentrynextjs-10752-10753-break-nextjs-on-cloudflare-workers
Oct 27, 2026
Merged

logaretm merged 1 commit into
v10from
awad/js-3994-sentrynextjs-10752-10753-break-nextjs-on-cloudflare-workers

Conversation

@logaretm

@logaretm logaretm commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Webpack-built OpenNext workers have an empty __filename, so the module-scope createRequire in config/util threw on import and failed the instrumentation hook, fixed by creating that require inside resolveNextjsPackageJson.

To test this properly we would need to add an app specifically to test this, which doesn't seem worth it for v10. This issue doesn't occur in v11 because the server entry no longer exports config paths, so the createRequire call is never evaluated.

closes #25683

… workers don't crash on import

Webpack-built OpenNext workers have an empty `__filename`, so the module-scope
`createRequire` in `config/util` threw as soon as the server entry was imported,
failing the instrumentation hook on every request.
@linear-code

linear-code Bot commented Oct 24, 2026

Copy link
Copy Markdown

JS-3994

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.28 kB added added
@sentry/browser - with treeshaking flags 26.73 kB added added
@sentry/browser (incl. Tracing) 47.3 kB added added
@sentry/browser (incl. Tracing + Span Streaming) 49.1 kB added added
@sentry/browser (incl. Tracing, Profiling) 52.09 kB added added
@sentry/browser (incl. Tracing, Replay) 86.75 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 76.38 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 91.46 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 104.08 kB added added
@sentry/browser (incl. Feedback) 45.45 kB added added
@sentry/browser (incl. sendFeedback) 33.09 kB added added
@sentry/browser (incl. FeedbackAsync) 38.21 kB added added
@sentry/browser (incl. Metrics) 29.38 kB added added
@sentry/browser (incl. Logs) 29.61 kB added added
@sentry/browser (incl. Metrics & Logs) 30.3 kB added added
@sentry/react 30.1 kB added added
@sentry/react (incl. Tracing) 49.6 kB added added
@sentry/vue 34.17 kB added added
@sentry/vue (incl. Tracing) 49.68 kB added added
@sentry/svelte 28.31 kB added added
CDN Bundle 30.69 kB added added
CDN Bundle (incl. Tracing) 49.25 kB added added
CDN Bundle (incl. Logs, Metrics) 32.28 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 50.57 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 71.75 kB added added
CDN Bundle (incl. Tracing, Replay) 86.99 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.27 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 92.8 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.08 kB added added
CDN Bundle - uncompressed 91.2 kB added added
CDN Bundle (incl. Tracing) - uncompressed 148.46 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 95.91 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 152.44 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 221.4 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 268.43 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 272.39 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 282.13 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 286.08 kB added added
@sentry/nextjs (client) 52.25 kB added added
@sentry/sveltekit (client) 47.75 kB added added
@sentry/core/server 81.66 kB added added
@sentry/core/browser 67.73 kB added added
@sentry/node-core 64.1 kB added added
@sentry/node 127.28 kB added added
@sentry/node (incl. diagnostics channel injection) 171.48 kB added added
@sentry/node/import (ESM hook with diagnostics-channel injection) 166 B added added
@sentry/node/light 52.19 kB added added
@sentry/node - without tracing 75.89 kB added added
@sentry/aws-serverless 85.04 kB added added
@sentry/cloudflare (withSentry) - minified 204.93 kB added added
@sentry/cloudflare (withSentry) 505.2 kB added added

@logaretm
logaretm marked this pull request as ready for review October 26, 2026 15:08
@logaretm
logaretm requested a review from a team as a code owner October 26, 2026 15:08
@logaretm
logaretm requested review from chargome and nicohrubec and removed request for a team October 26, 2026 15:08

@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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 5176777. Configure here.

Comment thread packages/nextjs/src/config/util.ts Resolved
@logaretm
logaretm requested a review from s1gr1d October 26, 2026 15:18

@nicohrubec nicohrubec left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

since this only affects v10 fine to proceed without adding a full e2e app for this imo

@logaretm
logaretm merged commit 0664050 into v10 Oct 27, 2026
163 of 165 checks passed
@logaretm
logaretm deleted the awad/js-3994-sentrynextjs-10752-10753-break-nextjs-on-cloudflare-workers branch October 27, 2026 13:49
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.

2 participants