Title: SDK fails in ESM mode in combination with date-fns · Issue #12154 · getsentry/sentry-javascript · GitHub
Open Graph Title: SDK fails in ESM mode in combination with date-fns · Issue #12154 · getsentry/sentry-javascript
X Title: SDK fails in ESM mode in combination with date-fns · Issue #12154 · getsentry/sentry-javascript
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/...
Open Graph 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 th...
X 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 th...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/12154
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"SDK fails in ESM mode in combination with date-fns","articleBody":"### Is there an existing issue for this?\n\n- [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\n- [X] I have reviewed the documentation https://docs.sentry.io/\n- [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\n\n### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Which SDK are you using?\n\n@sentry/node\n\n### SDK Version\n\n8.2.1\n\n### Framework Version\n\nNodejs 20.13.1\n\n### Link to Sentry event\n\nhttps://mycopilot.sentry.io/issues/5344731586/?project=6067364&query=is%3Aunresolved&referrer=issue-stream&statsPeriod=24h&stream_index=0\n\n### SDK Setup\n\n```ts\r\nSentry.init({\r\n dsn: \"[REDACTED]\",\r\n});\r\n```\n\n### Steps to Reproduce\n\n1. Upgrade from v7 to v8 following the migration docs\r\n2. Follow Sentry docs for ESM\r\n3. Add `--import ./dist/instrument.js` to the `node` command\n\n### Expected Result\n\nApplication starts up.\n\n### Actual Result\n\nApplication crashes with an error which seems to involve duplicate exports with ESM. An example of my particular error:\r\n\r\n```bash\r\nSyntaxError: Identifier '$longFormatters' has already been declared\r\n at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:169:18)\r\n at callTranslator (node:internal/modules/esm/loader:272:14)\r\n at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:278:30)\r\n```\r\n\r\nUpon investigating, I found my error to be related to the `date-fns` package and [this issue](https://github.com/date-fns/date-fns/issues/3769). 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).\r\n\r\nThis 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.","author":{"url":"https://github.com/Xhale1","@type":"Person","name":"Xhale1"},"datePublished":"2024-05-22T03:10:07Z","url":"https://github.com/getsentry/sentry-javascript/issues/12154"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b31bcfd9-d620-688b-d462-594d98248939 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ACE8:1BBF52:F1D75D:144688E:6B03C82B |
| html-safe-nonce | da2b61611697d657b169ad221f2cae0a0d4c2a1ec1b3c09a6f6e224cd036d9f8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQ0U4OjFCQkY1MjpGMUQ3NUQ6MTQ0Njg4RTo2QjAzQzgyQiIsInZpc2l0b3JfaWQiOiI0OTQ3NjAxMDcwNTY2ODEzOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7829445c8a987724984f8dc3f43e55bc9e47e9546033bf1276bbe56a90af5fc1 |
| hovercard-subject-tag | issue:2309479213 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/12154/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b959696296da0876858c29983957899336a2caedfb9be08b3bd0205b8d4b006b/getsentry/sentry-javascript/issues/12154 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b959696296da0876858c29983957899336a2caedfb9be08b3bd0205b8d4b006b/getsentry/sentry-javascript/issues/12154 |
| og:image:alt | 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 th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Xhale1 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width