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.2.1
Framework Version
Nodejs 20.13.1
Link to Sentry event
https://mycopilot.sentry.io/issues/5344731586/?project=6067364&query=is%3Aunresolved&referrer=issue-stream&statsPeriod=24h&stream_index=0
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 the node 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.
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.2.1
Framework Version
Nodejs 20.13.1
Link to Sentry event
https://mycopilot.sentry.io/issues/5344731586/?project=6067364&query=is%3Aunresolved&referrer=issue-stream&statsPeriod=24h&stream_index=0
SDK Setup
Steps to Reproduce
--import ./dist/instrument.jsto thenodecommandExpected 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-fnspackage and this issue. Revertingdate-fnsto a version without a duplicate export results in another similar error (I suspect related to theopenaipackage duplicate export though haven't confirmed).This issue does not occur when using the
--importflag 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.