Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/browser
SDK Version
8.4.0
"openai": "^4.33.1"
Framework Version
Node 8.4.0
Link to Sentry event
No response
SDK Setup
// instrumentation.tsSentry.init({dsn: "",// Set tracesSampleRate to 1.0 to capture 100%// of transactions for performance monitoring.// We recommend adjusting this value in productiontracesSampleRate: process.env.NODE_ENV==="prod" ? 0.2 : 1,profilesSampleRate: 1,// Relative to tracesSampleRateenvironment: process.env.NODE_ENV,enabled: process.env.NODE_ENV==="prod",});Steps to Reproduce
https://github.com/danilofuchs/sentry-esm-openai-repro
- Add
openai package - Instrument using
instrumentation.js file - Run with
node --import ./build/instrumentation.js build/server.js
Expected Result
Runs with Sentry instrumentation.
Perhaps related to #12059 and #12154 (import-in-the-middle bugs)
Actual Result
> node --import ./build/instrumentation.js build/server.js
file:///home/project/node_modules/openai/resources/beta/assistants/files.mjs:51
Files.AssistantFilesPage = FilesAPI.AssistantFilesPage;
^
ReferenceError: Cannot access 'AssistantFilesPage' before initialization
at file:///project/node_modules/openai/resources/beta/assistants/files.mjs:51:41
at file:///home/project/node_modules/openai/resources/beta/assistants/files.mjs:52:3
at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:323:24)
at async loadESM (node:internal/process/esm_loader:28:7)
at async handleMainPromise (node:internal/modules/run_main:113:12)
Node.js v20.12.2
files.mjs:51:41:
exportclassAssistantFilesPageextendsCursorPage{}(function(Files){Files.AssistantFilesPage=FilesAPI.AssistantFilesPage;})(Files||(Files={}));//# sourceMappingURL=files.mjs.mapObs:
Setting globalThis._sentryEsmLoaderHookRegistered = true; before Sentry.init fixes the crash but disables auto instrumentation
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/browser
SDK Version
8.4.0
"openai": "^4.33.1"
Framework Version
Node 8.4.0
Link to Sentry event
No response
SDK Setup
Steps to Reproduce
https://github.com/danilofuchs/sentry-esm-openai-repro
openaipackageinstrumentation.jsfilenode --import ./build/instrumentation.js build/server.jsExpected Result
Runs with Sentry instrumentation.
Perhaps related to #12059 and #12154 (import-in-the-middle bugs)
Actual Result
files.mjs:51:41:
Obs:
Setting
globalThis._sentryEsmLoaderHookRegistered = true;beforeSentry.initfixes the crash but disables auto instrumentation