-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.
in exports
property of CJS file breaks dynamic imports
#12622
Comments
For some additional context, this works fine in |
Sorry for the trouble, this is def some issues with the new automatic instrumentation in Could you apply |
I had to install {
"type": "module",
"scripts": {
"postinstall": "patch-package"
},
"dependencies": {
"@sentry/node": "^8.11.0",
"import-in-the-middle": "^1.8.0",
"patch-package": "^8.0.0"
}
} Running |
This is currently tracked upstream by nodejs/import-in-the-middle#94 I've been thinking of some ways to work around this and should get a PR submitted this week! |
v8.29.0 of the Node SDK added a new import * as Sentry from '@sentry/node';
Sentry.init({
dsn: '__PUBLIC_DSN__',
registerEsmLoaderHooks: { onlyIncludeInstrumentedModules: true },
}); When set to This feature will only work if you Please let me know if this helps work around the |
👀 This seems to work just fine, but I am curious what the ramifications are of setting this. What exactly stops working by no longer instrumenting these files? I assume something does, otherwise this'd be a default? |
By default
import * as Sentry from '@sentry/node';
import * as net from 'node:net';
Sentry.init({}); There are a couple of fundamental issues with If you enable the The only downside with this option is that Sentry needs to be initialised before any module we want to instrument is loaded. This can be achieved by loading Sentry via import * as Sentry from '@sentry/node';
Sentry.init({});
await import('./my-app');
If we still need to use |
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.11.0
Framework Version
No response
Link to Sentry event
No response
SDK Setup
Steps to Reproduce
package.json
:index.js
:other.cjs
:Expected Result
It runs, outputting:
(this can be reproduced by commenting out the
Sentry.init();
line)Actual Result
It fails on a sytax error:
The text was updated successfully, but these errors were encountered: