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.2.1
Framework Version
Nodejs 20.13.1
Link to Sentry event
SDK Setup
Sentry.init({
dsn: "[REDACTED]",
});
Steps to Reproduce
- Upgrade from v7 to v8 following the migration docs
- Follow Sentry docs for ESM
- Add
--import ./dist/instrument.js
to thenode
command
Expected Result
Application starts up.
Actual Result
Application crashes with an error which seems to involve duplicate exports with ESM. An example of my particular error:
SyntaxError: Identifier '$longFormatters' has already been declared
at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:169:18)
at callTranslator (node:internal/modules/esm/loader:272:14)
at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:278:30)
Upon investigating, I found my error to be related to the date-fns
package and this issue. Reverting date-fns
to a version without a duplicate export results in another similar error (I suspect related to the openai
package duplicate export though haven't confirmed).
This issue does not occur when using the --import
flag to load a file without sentry code in it, and it doesn't surface elsewhere. This error may be due to other projects misusing ESM, though I hope since the issue only surfaces with Sentry instrumentation that it may be solvable here.
Metadata
Metadata
Assignees
Type
Projects
Status