Title: SDK fails in ESM mode in combination with openai · Issue #12414 · getsentry/sentry-javascript · GitHub
Open Graph Title: SDK fails in ESM mode in combination with openai · Issue #12414 · getsentry/sentry-javascript
X Title: SDK fails in ESM mode in combination with openai · Issue #12414 · 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/12414
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"SDK fails in ESM mode in combination with openai","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.8.0\n\n### Framework Version\n\nNode 20.14.0\n\n### Link to Sentry event\n\nhttps://trainwell.sentry.io/issues/5463070600/?project=6067364&query=is%3Aunresolved+issue.priority%3A%5Bhigh%2C+medium%5D&referrer=issue-stream&statsPeriod=14d&stream_index=1\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. Add `openai` package\r\n1. Instrument using instrumentation.js file\r\n1. Run with node --import ./dist/instrumentation.js dist/index.js\r\n\r\nThe addition of the following code is what triggers the issue:\r\n```ts\r\nimport OpenAI from \"openai\";\r\n\r\nconst openAI = new OpenAI({\r\n apiKey: \"[REDACTED]\",\r\n});\r\n```\n\n### Expected Result\n\nApp builds with sentry instrumentation and no errors.\n\n### Actual Result\n\nI receive the following error:\r\n```\r\nTypeError: API.Completions is not a constructor\r\n at new OpenAI (file:///[REDACTED]/node_modules/.pnpm/openai@4.49.0/node_modules/openai/index.mjs:46:28)\r\n at file:///[REDACTED]\r\n at ModuleJob.run (node:internal/modules/esm/module_job:222:25)\r\n at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)\r\n at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)\r\n```\r\n\r\nThis might be related to https://github.com/getsentry/sentry-javascript/issues/12237 however it appears to be a unique issue unrelated to initialization.","author":{"url":"https://github.com/Xhale1","@type":"Person","name":"Xhale1"},"datePublished":"2024-06-07T16:49:52Z","url":"https://github.com/getsentry/sentry-javascript/issues/12414"}
| 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:17d7c727-a0dc-226c-5095-902149e10046 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 82C2:816EC:422CEF:577FED:6B038192 |
| html-safe-nonce | 73955bfd34c4e44fea64bd322b5310875f866509682e6592ee18a6ebee839262 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MkMyOjgxNkVDOjQyMkNFRjo1NzdGRUQ6NkIwMzgxOTIiLCJ2aXNpdG9yX2lkIjoiMTM0OTgxMjc5NzM0NDgwOTM2MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 05a6b1288673cd531d588bf853464ea573608a028ff5b3e250ff0808582381e0 |
| hovercard-subject-tag | issue:2340834886 |
| 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/12414/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2428dc2bfeb6ea3d2dfc2d5352c19bf1757bb40f115a7c5ecabeb49481f0a7e6/getsentry/sentry-javascript/issues/12414 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2428dc2bfeb6ea3d2dfc2d5352c19bf1757bb40f115a7c5ecabeb49481f0a7e6/getsentry/sentry-javascript/issues/12414 |
| 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