-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Filter out ESM-incompatible defaultIntegrations when running in ESM #16146
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
Comments
Part of the problem is that it's possible to start Sentry in one mode (esm/cjs) and then use code in the other. The mode you start Sentry in is just a strong hint at what you might be using most. |
Do you mean because of |
The issues existed before Currently, if we detect ESM at init, we don't include the Users can For Next.js, all user code is transpiled to CJS, so at init we detect CJS, but Next.js core is actually ESM and loads some stuff via My main point is that we need to be careful about ESM/CJS detection at init time because with both |
Thanks for sharing this! What a mess 😭 So IIUC, deactivating the integration is risky because our ESM detection could be off, for example if people So maybe we should do something less drastic, something along the lines of emitting a debug log in the integration:
|
That... all sucks a lot xD I am a bit torn, it still seems like it would be the better experience to not add these integrations if we detect ESM 🤔 out of the box, nothing will break at least. Users can then manually add the integrations back if they now it works (or try it out....) So what about this concrete idea:
|
Which integrations have issues with ESM? |
Problem Statement
While working on #16137 we realized that quite a lot of Otel instrumentation is currently not compatible with ESM. In some (all?) cases this goes as far as the application breaking if the instrumentation tries to patch a package but isn't compatible with the ESM exports
Solution Brainstorm
We should avoid trying to apply instrumentations known to break ESM apps. Currently I'm we're thinking of creating a denyList of defaultIntegrations to filter out. Let's only apply this to default integrations. If users specifically add an integration, this is on them.
This also involves adding more tests for our integrations in both CJS and ESM to be aware of this.
The text was updated successfully, but these errors were encountered: