Title: server-runtime-injection: ESM hook's vendored imports and @sentry/core ESM build are not traced on Next.js/Vercel, so registration fails on every cold start · Issue #26121 · getsentry/sentry-javascript · GitHub
Open Graph Title: server-runtime-injection: ESM hook's vendored imports and @sentry/core ESM build are not traced on Next.js/Vercel, so registration fails on every cold start · Issue #26121 · getsentry/sentry-javascript
X Title: server-runtime-injection: ESM hook's vendored imports and @sentry/core ESM build are not traced on Next.js/Vercel, so registration fails on every cold start · Issue #26121 · getsentry/sentry-javascript
Description: Environment @sentry/nextjs 11.10.0 (with @sentry/node, @sentry/server-runtime-injection and @sentry/core 11.10.0) Next.js 16.4.3, App Router, next build with Turbopack (the default) pnpm 9.15.0 (isolated node_modules/.pnpm store) Vercel,...
Open Graph Description: Environment @sentry/nextjs 11.10.0 (with @sentry/node, @sentry/server-runtime-injection and @sentry/core 11.10.0) Next.js 16.4.3, App Router, next build with Turbopack (the default) pnpm 9.15.0 (is...
X Description: Environment @sentry/nextjs 11.10.0 (with @sentry/node, @sentry/server-runtime-injection and @sentry/core 11.10.0) Next.js 16.4.3, App Router, next build with Turbopack (the default) pnpm 9.15.0 (is...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/26121
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"server-runtime-injection: ESM hook's vendored imports and @sentry/core ESM build are not traced on Next.js/Vercel, so registration fails on every cold start","articleBody":"### Environment\n\n- `@sentry/nextjs` 11.10.0 (with `@sentry/node`, `@sentry/server-runtime-injection` and `@sentry/core` 11.10.0)\n- Next.js 16.4.3, App Router, `next build` with Turbopack (the default)\n- pnpm 9.15.0 (isolated `node_modules/.pnpm` store)\n- Vercel, Node.js 22 functions (`nodejs22.x`)\n- `Sentry.init` in `sentry.server.config.ts` with default options, `tracesSampleRate: 0`\n\n### What happens\n\nEvery cold start of a Node function logs:\n\n```\n[Sentry] Failed to register diagnostics-channel injection hooks (Cannot find module '/var/task/node_modules/.pnpm/@sentry+server-runtime-injection@11.10.0/node_modules/@sentry/server-runtime-injection/build/esm/vendored/@apm-js-collab/tracing-hooks/hook.js' imported from /var/task/node_modules/.pnpm/@sentry+server-runtime-injection@11.10.0/node_modules/@sentry/server-runtime-injection/build/esm/hook.js), so channel-based integrations will not record spans.\n```\n\n#23687 made `build/esm/hook.js` itself traceable, and #25480 added `build/esm/package.json`. Both fixes are in 11.10.0, and `hook.js` does reach the function. But `hook.js` imports from `build/esm/vendored/**`, which Next's file trace does not follow. My guess is that this is because `register.js` hands the hook to `Module.register()` by runtime path.\n\n### What we tried\n\nWe added the package's ESM build to every route's trace:\n\n```js\noutputFileTracingIncludes: {\n \"/**\": [\"./node_modules/.pnpm/@sentry+server-runtime-injection@*/node_modules/@sentry/server-runtime-injection/build/esm/**/*.{js,json}\"],\n}\n```\n\nAfter deploying, some functions still logged the missing vendored `hook.js`. Others got past it and failed on the next missing file:\n\n```\n[Sentry] Failed to register diagnostics-channel injection hooks (Cannot find module '/var/task/node_modules/.pnpm/@sentry+server-runtime-injection@11.10.0/node_modules/@sentry/core/build/esm/index.js' imported from /var/task/node_modules/.pnpm/@sentry+server-runtime-injection@11.10.0/node_modules/@sentry/server-runtime-injection/build/esm/debug.js\nDid you mean to import \"@sentry/core/build/cjs/index.js\"?)\n```\n\nThe rest of the app loads `@sentry/core` as CJS, so its ESM build is never traced. The ESM loader hook graph (the vendored tree, `debug.js`, and `@sentry/core`'s ESM build) needs to be either self-contained in the package or reachable by the tracer.\n\n### Expected\n\nWith default options on Next.js + Vercel, either the hook registers, or the SDK skips it quietly when its files are absent, instead of warning on every cold start.\n\n### Workaround\n\n`enableRuntimeChannelInjection: false` in the server `Sentry.init`. That's fine for us because tracing is off, but it silently turns off channel-based spans for anyone who has tracing on.\n","author":{"url":"https://github.com/charlesrhoward","@type":"Person","name":"charlesrhoward"},"datePublished":"2026-11-05T04:28:56Z","url":"https://github.com/getsentry/sentry-javascript/issues/26121"}
| 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:c24ee84f-b9ac-9707-f008-81ae06369916 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D02C:1D4BD6:45DF52:61FA7F:6B0441F9 |
| html-safe-nonce | 3e0ab98f1d08696d03e6ba0ba3108de546201e791840d3271a24e5a43791a494 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMDJDOjFENEJENjo0NURGNTI6NjFGQTdGOjZCMDQ0MUY5IiwidmlzaXRvcl9pZCI6IjkzNzkxMTY2ODI4ODI3NDkzNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f95c9cb88a2a05189f372e4dfdd2cd6970894e260a4e0198143ba412959fedaa |
| hovercard-subject-tag | issue:6216781196 |
| 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/26121/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1ad838bd9910c8a3466a6dc404160f33bebc90c20be1c3bbaa58bb0e8b5fdf31/getsentry/sentry-javascript/issues/26121 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1ad838bd9910c8a3466a6dc404160f33bebc90c20be1c3bbaa58bb0e8b5fdf31/getsentry/sentry-javascript/issues/26121 |
| og:image:alt | Environment @sentry/nextjs 11.10.0 (with @sentry/node, @sentry/server-runtime-injection and @sentry/core 11.10.0) Next.js 16.4.3, App Router, next build with Turbopack (the default) pnpm 9.15.0 (is... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | charlesrhoward |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9185ccfefd80c1ff2d9ddcdb0cd2becf46b5a1efbbf30741a895e4bb8de25e64 |
| 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 | 06dc448a76fe4751ac1db26524aefa3aa3e889a8 |
| 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