Closed
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/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
8.9.1
Framework Version
Node v20.12.1
Link to Sentry event
No response
SDK Setup
Sentry.init({
dsn,
environment,
enabled,
tracesSampleRate,
});
Steps to Reproduce
Migrated from v7 to v8.
Added the @sentry/node/preload and it failed to run.
#12357 is similar but it's using tsx
, the loaders order is wrong according to the thread; here I'm explicitly specifing the loaders order and I'm using ts-node with EMS. Using tsx
is not negotiable given that they don't support the experimental legacy decorators.
By following #12422, I was able to make it work using: tsc --build && node --import @sentry/node/preload -r dotenv/config dist/index.js
; but that's by not using ts-node
, which is the issue I'm bringing up.
Expected Result
No error
Actual Result
SENTRY_DEBUG=1 node --import @sentry/node/preload --import ../ts-node.register.mjs -r dotenv/config src/index.ts
Sentry Logger [debug]: @opentelemetry/api: Registered a global for diag v1.9.0.
Sentry Logger [log]: [Sentry] Preloaded Http instrumentation
Sentry Logger [log]: [Sentry] Preloaded Express instrumentation
Sentry Logger [log]: [Sentry] Preloaded Connect instrumentation
Sentry Logger [log]: [Sentry] Preloaded Fastify instrumentation
Sentry Logger [log]: [Sentry] Preloaded Hapi instrumentation
Sentry Logger [log]: [Sentry] Preloaded Koa instrumentation
Sentry Logger [log]: [Sentry] Preloaded Nest instrumentation
Sentry Logger [log]: [Sentry] Preloaded Mongo instrumentation
Sentry Logger [log]: [Sentry] Preloaded Mongoose instrumentation
Sentry Logger [log]: [Sentry] Preloaded Mysql instrumentation
Sentry Logger [log]: [Sentry] Preloaded Mysql2 instrumentation
Sentry Logger [log]: [Sentry] Preloaded Postgres instrumentation
Sentry Logger [log]: [Sentry] Preloaded Hapi instrumentation
Sentry Logger [log]: [Sentry] Preloaded Graphql instrumentation
Sentry Logger [log]: [Sentry] Preloaded Redis instrumentation
Error [ERR_UNKNOWN_BUILTIN_MODULE]: No such built-in module: node:http?iitm=true
at ModuleLoader.builtinStrategy (node:internal/modules/esm/translators:465:11)
at callTranslator (node:internal/modules/esm/loader:279:14)
at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:285:30) {
code: 'ERR_UNKNOWN_BUILTIN_MODULE'
}
../ts-node.register.mjs
content is:
import { register } from "node:module";
import { pathToFileURL } from "node:url";
process.on('uncaughtException', function (err) {
console.error(err);
process.exit(1);
});
register("ts-node/esm", pathToFileURL("./"));
Metadata
Metadata
Assignees
Type
Projects
Status
No status