Uh oh!
There was an error while loading. Please reload this page.
feat(node)!: Remove import-in-the-middle ESM loader and deprecated instrumentation base - #22755
Conversation
…strumentation base With all vendored OpenTelemetry instrumentations removed, `@sentry/node` no longer has any import-in-the-middle module patchers. This removes the remaining iitm plumbing: - Remove the `registerEsmLoaderHooks` option and drop the `import-in-the-middle` dependency; the SDK no longer registers ESM loader hooks. - Delete the shared `InstrumentationNodeModuleFile` helper and the ESM loader. - Remove the deprecated `SentryHttpInstrumentation` and `SentryNodeFetchInstrumentation` classes (the diagnostics-channel-based `instrumentHttpOutgoingRequests` / `instrumentUndici` functions are kept). Closes: #22346 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Uh oh!
There was an error while loading. Please reload this page.
Add the `registerEsmLoaderHooks` option removal to the v11 migration guide, and fold `SentryNodeFetchInstrumentation` into the existing `SentryHttpInstrumentation` removal entry.
| "@sentry/opentelemetry": "10.67.0", | ||
| "@sentry/server-utils": "10.67.0", | ||
| "@sentry/bundler-plugins": "10.67.0", | ||
| "import-in-the-middle": "^3.0.0" |
andreiborza
commented
Jul 28, 2026
Removing |
size-limit report 📦
|
Both packages inject `import 'import-in-the-middle/hook.mjs'` into their built server output and previously relied on the package being present transitively through `@sentry/node`. Now that `@sentry/node` no longer depends on it, they must declare it directly, otherwise the built server fails to start with `ERR_MODULE_NOT_FOUND` for `import-in-the-middle/hook.mjs`.
Uh oh!
There was an error while loading. Please reload this page.
This reverts commit a844096.
Both packages injected `import 'import-in-the-middle/hook.mjs'` into their built server entry so bundlers would include the file for `@sentry/node`'s esmLoader to `module.register()` at runtime. With the esmLoader removed, nothing registers the hook anymore (the file is inert on import), so the injection only forced a now-dead dependency into the output and broke server startup with `ERR_MODULE_NOT_FOUND`. Drops the injection (and the solidstart `additionalImports` plumbing that existed solely for it).
| - feat(node)!: Remove `import-in-the-middle`-based instrumentations from `@sentry/node`. All performance integrations are now channel-based via `@sentry/server-utils`. As part of this: | ||
| - The `registerEsmLoaderHooks` option was removed from `NodeOptions`. The SDK no longer registers `import-in-the-middle` ESM loader hooks, and `import-in-the-middle` is no longer a dependency. | ||
| - `knexIntegration` and `dataloaderIntegration` are now channel-only and no longer fall back to OpenTelemetry instrumentation on runtimes without diagnostics-channel injection. | ||
| - Support for Fastify `<3.21.0` was dropped. |
There was a problem hiding this comment.
What is this? The entire changelog entry you mean or dropping fastify?
There was a problem hiding this comment.
Tbh I think the changelog entry is useless anyway, I'll remove
…mbing # Conflicts: # packages/node/src/utils/detection.ts
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4ed3550. Configure here.
Uh oh!
There was an error while loading. Please reload this page.



What
Final cleanup PR. Once the vendored OpenTelemetry instrumentations are gone,
@sentry/nodehas no import-in-the-middle module patchers left, so this removes the remaining iitm plumbing:registerEsmLoaderHooksoption fromNodeOptionsand drop theimport-in-the-middledependency.InstrumentationNodeModuleFilehelper,esmLoader.ts, and the ESM-loader detection util.SentryHttpInstrumentationandSentryNodeFetchInstrumentationclasses. The live diagnostics-channel-basedinstrumentHttpOutgoingRequests/instrumentUndicifunctions are kept.esm/import-in-the-middleintegration-test suite and add the changelog entry.Why
These were the last pieces tying
@sentry/nodeto import-in-the-middle. All performance integrations are channel-based via@sentry/server-utils(default since #22501), so the ESM loader hook served nothing.Closes: #22346