Title: @sentry/nextjs 10.75.2 / 10.75.3 break Next.js on Cloudflare Workers (OpenNext): "An error occurred while loading the instrumentation hook" · Issue #25683 · getsentry/sentry-javascript · GitHub
Open Graph Title: @sentry/nextjs 10.75.2 / 10.75.3 break Next.js on Cloudflare Workers (OpenNext): "An error occurred while loading the instrumentation hook" · Issue #25683 · getsentry/sentry-javascript
X Title: @sentry/nextjs 10.75.2 / 10.75.3 break Next.js on Cloudflare Workers (OpenNext): "An error occurred while loading the instrumentation hook" · Issue #25683 · 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/25683
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"@sentry/nextjs 10.75.2 / 10.75.3 break Next.js on Cloudflare Workers (OpenNext): \"An error occurred while loading the instrumentation hook\"","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- [ ] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\n\nThis report concerns the tested v10 versions below. We have not tried v11.\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\n10.75.2 (also 10.75.3). Works on 10.75.0.\n\n### Framework Version\n\nNext.js 15.5.28 (App Router), @opennextjs/cloudflare 1.20.12, wrangler 4.151.1. Cloudflare Workers with `compatibility_flags = [\"nodejs_compat\"]`, `compatibility_date = \"2025-09-10\"`.\n\n### Link to Sentry event\n\n_No response_\n\n### Reproduction Example/SDK Setup\n\n`instrumentation.ts`:\n\n```ts\nimport * as Sentry from \"@sentry/nextjs\";\n\nexport async function register() {\n if (process.env.NEXT_RUNTIME === \"nodejs\") {\n await import(\"./sentry.server.config\");\n }\n if (process.env.NEXT_RUNTIME === \"edge\") {\n await import(\"./sentry.edge.config\");\n }\n}\n\nexport const onRequestError = Sentry.captureRequestError;\n```\n\n`next.config.js` wraps the config with `withSentryConfig` (org, project, authToken, `hideSourceMaps`). No `tunnelRoute` is configured.\n\n### Steps to Reproduce\n\n1. Next.js 15.5 App Router app deployed to Cloudflare Workers with `@opennextjs/cloudflare`, using the setup above, on `@sentry/nextjs` 10.75.0. Everything works.\n2. Upgrade `@sentry/nextjs` to 10.75.2 (to pick up the fix for GHSA-mchm-gjx6-7h55). `npx opennextjs-cloudflare build` succeeds.\n3. Request any server-rendered page. We saw the failure on our staging deployment on Cloudflare Workers (10.75.2), and reproduced it locally with `npx opennextjs-cloudflare preview` (10.75.2 and 10.75.3).\n\n### Expected Result\n\nPages render as they do on 10.75.0.\n\n### Actual Result\n\nEvery server-rendered route returns 500 with `{\"message\":\"Server failed to respond.\",\"details\":{}}`. Static assets are still served. The worker logs repeat:\n\n```\nFailed to prepare server Error: An error occurred while loading the instrumentation hook\nNextJS request failed. Error: An error occurred while loading the instrumentation hook\n```\n\nNo more detailed cause is logged.\n\n### Additional Context\n\nThis looks like it comes from #24475 (released in 10.75.1). It changed `packages/nextjs/src/config/util.ts` to call `createRequire` at module scope:\n\n- `build/cjs/config/util.js`: `sdkRequire = module$1.createRequire(__filename);`\n- `build/esm/config/util.js`: `sdkRequire = createRequire(import.meta.url);`\n\nAt runtime this module is reachable from the server entry: `build/cjs/index.server.js` → `./config/deprecatedWithSentryConfig.js` → … → `config/util.js` (for example via `config/withSentryConfig/getFinalConfigObject.js`). Importing `@sentry/nextjs` from the instrumentation file therefore runs this call when the module loads. The isolated test below points to this module-scope initialization as the trigger in our Workers setup; we have not captured the underlying exception.\n\nWhat we observed:\n\n- Staging deployment on Cloudflare Workers: 10.75.0 works; 10.75.2 returns 500 on all server-rendered pages with the error above.\n- Locally with `opennextjs-cloudflare preview`:\n - 10.75.0: tested server-rendered routes returned 200.\n - 10.75.2 and 10.75.3: tested server-rendered routes returned 500 with the error above.\n - 10.75.2 with only that one statement (cjs and esm) wrapped in `try/catch` inside `node_modules`: `/`, `/search`, a villa route, and `/auth/signin` returned 200 again, with no instrumentation-hook errors.\n\nThe same statement also appears in the published 10.75.1 and 10.76.2 packages (package inspection only; we did not run them). We have not tried 11.x.\n\nA possible fix: create `sdkRequire` lazily inside the function that needs it (or guard the call), so that importing the server entry does not eagerly call `createRequire`. Another option is to keep build-time config utilities out of the runtime server entry.\n","author":{"url":"https://github.com/miya-start","@type":"Person","name":"miya-start"},"datePublished":"2026-10-23T08:01:40Z","url":"https://github.com/getsentry/sentry-javascript/issues/25683"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:18d9180f-2c2c-9aa8-14cf-ea03eb629643 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 84F8:13442E:1AF369:24F185:6B044858 |
| html-safe-nonce | aad4c4055d1b8626dd7a413e306a0cd9d64bce5f46d11c7457763c50841d9e1b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NEY4OjEzNDQyRToxQUYzNjk6MjRGMTg1OjZCMDQ0ODU4IiwidmlzaXRvcl9pZCI6Ijg4ODA1NzU4MTk5Njg4NjEwNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 72414320cf1a7845540eb4ae368d7881376d97c4a6b56f08d95aa98b2eaa5cf4 |
| hovercard-subject-tag | issue:5994182441 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/25683/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1b3024b11ca68b071c4c751ad1b06a1ff6450fd994545fdd8de8de91e1a8db22/getsentry/sentry-javascript/issues/25683 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1b3024b11ca68b071c4c751ad1b06a1ff6450fd994545fdd8de8de91e1a8db22/getsentry/sentry-javascript/issues/25683 |
| og:image:alt | 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... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | miya-start |
| hostname | github.com |
| expected-hostname | github.com |
| None | d4495c3631faba668036f176d1f5946901c5172efd73a6edb984029e7d4f8e46 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9ac4337fb7c6a5846cdfdb1a04f154d3c33ebc77 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width