-
-
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
Infinite error loop with modulesIntegration
in ESM
#14165
Labels
Package: node
Issues related to the Sentry Node SDK
Comments
Hi @kyranet, thanks so much for investigating and filing this. Indeed we should add some guarding here. |
This is a duplicate of #12500. Going to close this in favour of tracking this issue there. |
AbhiPrasad
added a commit
that referenced
this issue
Nov 4, 2024
resolves #12500 resolves #14165 `modulesIntegration` uses top-level require which will crash ESM apps if you explicitly import and use the integration. ```mjs // index.mjs Sentry.init({ dsn: '__DSN__', integrations: [ Sentry.modulesIntegration(), ] }); ``` This fixes that by adding a boolean check for cjs apps, and logging out a warning as a result.
A PR closing this issue has just been released 🚀This issue was referenced by PR #14169, which was included in the 8.37.0 release. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.36.0
Framework Version
Node.js v22.11.0
Link to Sentry event
No response
Reproduction Example/SDK Setup
Steps to Reproduce
captureException()
)Expected Result
Everything works as expected and an incident is created in the dashboard.
Actual Result
It doesn't create the incident... nor it responds, because:
The
collectModules()
function usesrequire
even in the ESM version, where it's not defined: https://yarnpkg.com/package?q=%40sentry%2Fnode&name=%40sentry%2Fnode&file=%2Fbuild%2Fesm%2Fintegrations%2Fmodules.jsThis causes whatever code is calling to throw an error over and over:
Which is repeated indefinitely, ramping the CPU usage to 100% and making the application not respond.
Removing
Sentry.modulesIntegration()
from the integrations list resolves this bug.The text was updated successfully, but these errors were encountered: