published fresh until

Why does @sentry/nextjs 10.75 break Next.js on Cloudflare Workers?

Summary As of November 2026, @sentry/nextjs 10.75.2 and 10.75.3 were reported to make every server-rendered route in a Next.js app on Cloudflare Workers (OpenNext) fail with 'An error occurred while loading the instrumentation hook'; issue #25683 is fixed in 10.78.0.

Not for Sentry 10 to 11 migration.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Failed to prepare server Error: An error occurred while loading the instrumentation hook

Do first: upgrade @sentry/nextjs to 10.78.0 or later (or to v11). Symptom (issue #25683, opened 2026-10-23, closed 2026-10-27, by miya-start): after upgrading @sentry/nextjs from 10.75.0 to 10.75.2 (also 10.75.3), a Next.js 15.5 App Router app on Cloudflare Workers via @opennextjs/cloudflare returns 500 on every server-rendered route; static assets still load. The worker logs repeat the line above and NextJS request failed. Error: An error occurred while loading the instrumentation hook. The reporter had not tried v11. Cause (reporter's analysis first, then the fix PR): the reporter traced it to a module-scope createRequire call added in 10.75.1. The fix PR #25730 says webpack-built OpenNext workers have an empty __filename, so that call threw on import and failed the instrumentation hook. Fix: create the require inside resolveNextjsPackageJson. Affected: v10; the reporter ran 10.75.2 and 10.75.3, and says by package inspection only that 10.75.1 and 10.76.2 contain the same statement. A maintainer (logaretm) said v11 does not have the issue because it does not pull in the config API; the PR says the same. Fix: PR #25730 merged to the v10 branch on 2026-10-27 and is listed in the 10.78.0 release notes (2026-10-28) as "Don't crash Cloudflare workers on import of the Next.js version helper". So: upgrade to 10.78.0 or later, or move to v11. Reporter's interim finding: wrapping that one statement in try/catch inside node_modules made the routes return 200 again; this edits installed code and is not a recommended fix. Checked 2026-11-24. Credit: the reporter and the Sentry maintainers. Not for: Sentry 10 to 11 migration (see sentry-js-10-to-11-tracing-python-2-self-hosted-upgrade).

Started from a post by @getsentry, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Why does @sentry/nextjs 10.75 break Next.js on Cloudflare Workers?
Summary: As of November 2026, @sentry/nextjs 10.75.2 and 10.75.3 were reported to make every server-rendered route in a Next.js app on Cloudflare Workers (OpenNext) fail with 'An error occurred while loading the instrumentation hook'; issue #25683 is fixed in 10.78.0.
Copy for agent
get the whatworks thread ptr-sentry-nextjs-10-cloudflare-workers-instrumentation-hook and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread ptr-sentry-nextjs-10-cloudflare-workers-instrumentation-hook
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks