Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
8.0.0
Framework Version
No response
Link to Sentry event
No response
SDK Setup
Sentry.init({
dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0',
});
Steps to Reproduce
I've created a minimal reproduction here: https://github.com/nwalters512/sentry-v8-tsx-error-repro
- Clone the repository
- Install dependencies with
yarn
- Run
yarn tsx src/index.ts
- Observe that the process fails with the error
TypeError [ERR_INVALID_URL_SCHEME]: The URL must be of scheme file
Several observations that are hopefully helpful to y'all:
-
This only occurs when "allowJs": true is set in tsconfig.json. As Sentry isn't concerned with this, that made me think this problem might actually be in tsx. However...
-
When adding instrumentation directly with the @opentelemetry/* packages, everything works fine. This is reproducible by making the following change to src/index.ts:
-import './instrument-sentry.js';
+import './instrument-opentelemetry.js';
Given this, I'm strongly inclined to believe that this is an issue with the way in which Sentry is using OpenTelemetry.
-
This only breaks for core Node modules like util, fs, etc. Importing other modules works fine. For instance, the following change to src/index.ts makes it work without erroring:
-await import('util');
+await import('zod');
-
This only breaks for dynamic imports. For instance, the following change to src/index.ts makes it work without erroring:
-await import('util');
+import 'util';
Expected Result
I would expect the process to complete successfully and log util imported!.
Actual Result
The process errors out while importing util and does not print util imported!.
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
8.0.0
Framework Version
No response
Link to Sentry event
No response
SDK Setup
Steps to Reproduce
I've created a minimal reproduction here: https://github.com/nwalters512/sentry-v8-tsx-error-repro
yarnyarn tsx src/index.tsTypeError [ERR_INVALID_URL_SCHEME]: The URL must be of scheme fileSeveral observations that are hopefully helpful to y'all:
This only occurs when
"allowJs": trueis set intsconfig.json. As Sentry isn't concerned with this, that made me think this problem might actually be intsx. However...When adding instrumentation directly with the
@opentelemetry/*packages, everything works fine. This is reproducible by making the following change tosrc/index.ts:Given this, I'm strongly inclined to believe that this is an issue with the way in which Sentry is using OpenTelemetry.
This only breaks for core Node modules like
util,fs, etc. Importing other modules works fine. For instance, the following change tosrc/index.tsmakes it work without erroring:This only breaks for dynamic imports. For instance, the following change to
src/index.tsmakes it work without erroring:Expected Result
I would expect the process to complete successfully and log
util imported!.Actual Result
The process errors out while importing
utiland does not printutil imported!.