You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(server-utils): Warn when the orchestrion runtime hook was bundled
`@sentry/node`'s `init()` installs a runtime module-transform hook from
`@sentry/server-utils/orchestrion/register`, which drives a vendored code
transformer (meriyah/astring/source-map) and is designed to run from
`node_modules`. If a downstream bundler inlines and tree-shakes
`@sentry/server-utils`, that transformer is stripped to empty objects, so at
runtime `parse`/`generate` are `undefined` and the first module the hook tries
to transform throws `TypeError: parse is not a function` — deep in the loader,
once per module, and only when `debug: true` (otherwise it fails silently).
Detect this once, up front: run a throwaway in-memory transform over a synthetic
snippet before installing any hook. A healthy build returns normally; a
tree-shaken one throws a `TypeError`. On detection, emit a single, always-on,
actionable warning (via `consoleSandbox`, deduped on a global marker) and skip
installing hooks that can't work, instead of letting the cryptic per-module
error surface. The existing registration `catch` is likewise upgraded to an
always-on warning.
All of this lives inside `registerDiagnosticsChannelInjection`, so it tree-shakes
away with the whole block when `bundleSizeOptimizations.excludeChannelInjection`
sets `__SENTRY_CHANNEL_INJECTION__` to `false`.
Ref #23664
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
feat(server-utils): Keep @sentry/node external in the vite orchestrion plugin
The runtime hook (reached via `@sentry/node`) must stay external so it resolves
from `node_modules`; bundling it strips the transformer and breaks the
`Module.register` self-reference. `@sentry/node` is a different package from the
`@sentry/server-utils` barrel the plugin force-bundles (`ssr.noExternal`), so the
vite plugin now also adds `@sentry/node` to `ssr.external`. Explicit `ssr.external`
entries win over `noExternal`, so this holds even against a preset that sets
`ssr.noExternal: true` — verified with a real vite SSR build.
This covers the vite-based frameworks (SvelteKit, Astro, React Router, TanStack);
the nitro/rollup frameworks (Nuxt, SolidStart) rely on the runtime warning above,
with a nitro-level externalization guard as a follow-up.
Ref #23664
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
docs(node): Document keeping @sentry/server-utils external when bundling
Add a "Bundling your server" note to the Node README (and a Nuxt troubleshoot
note) explaining that the runtime instrumentation hook must stay external, and
pointing to the build-time bundler-plugin instrumentation as the alternative.
Ref #23664
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fix(server-utils): Don't force @sentry/node external in the vite plugin
Forcing `@sentry/node` into `ssr.external` broke Cloudflare/worker builds: the
shared vite orchestrion plugin also runs under `@cloudflare/vite-plugin` (and
frameworks deploying to workerd), where `@sentry/node` is unused and setting
`resolve.external` on a worker environment is rejected outright — and the worker
environment is even named `ssr`, so there's no reliable node-vs-worker
discriminator in the `config()` hook. Vite already externalizes `@sentry/node`
for node SSR by default anyway, and the runtime probe in `orchestrion/register`
covers the cases where it does get bundled, so drop the forced externalization.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
feat(server-utils): Stay quiet when build-time instrumentation covers a bundled hook
If `@sentry/server-utils` was bundled AND the build-time bundler plugin ran (a
defined `__SENTRY_ORCHESTRION__.bundler` Set), instrumentation is already injected
at build time and the runtime hook is redundant — a supported setup. In that case
downgrade the "bundled" message to a debug log instead of an always-on warning.
The always-on warning now fires only when nothing instrumented the app (bundled
and no build-time plugin). Also corrects the Node README: bundling doesn't
disable auto-instrumentation when the build-time plugin is used.
Ref #23664
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
better comment
just use console
better comment
small fixes
bump size limit
fix test
Copy file name to clipboardExpand all lines: packages/nuxt/README.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,4 +28,9 @@ functionality related to Nuxt.
28
28
29
29
## Troubleshoot
30
30
31
+
If your server-side auto-instrumentation stops recording spans after bundling (e.g. certain Nitro
32
+
presets), make sure `@sentry/server-utils` is kept **external** in the Nitro/server build rather than
33
+
inlined — its runtime module hook must resolve from `node_modules`. `@sentry/node` logs a warning at
34
+
startup when it detects it was bundled.
35
+
31
36
If you encounter any issues with error tracking or integrations, refer to the official [Sentry Nuxt SDK documentation](https://docs.sentry.io/platforms/javascript/guides/nuxt/). If the documentation does not provide the necessary information, consider opening an issue on GitHub.
0 commit comments