Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prisma Client breaks loading Sentry with ESM (MJS) import method #12816

Closed
3 tasks done
vpmedia opened this issue Jul 9, 2024 · 3 comments
Closed
3 tasks done

Prisma Client breaks loading Sentry with ESM (MJS) import method #12816

vpmedia opened this issue Jul 9, 2024 · 3 comments
Labels
Package: node Issues related to the Sentry Node SDK Type: Bug

Comments

@vpmedia
Copy link

vpmedia commented Jul 9, 2024

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.15.0

Framework Version

No response

Link to Sentry event

No response

SDK Setup/Reproduction Example

git clone [email protected]:vpmedia/express-template.git
cd express-template
npm install
npm start

Steps to Reproduce

See reproduction example.

Expected Result

Loading and instrumenting working.

Actual Result

Error: 'import-in-the-middle' failed to wrap 'file:///Users/andras/Developer/OSS/express-template/node_modules/@prisma/client/default.js'
    at getSource (/Users/andras/Developer/OSS/express-template/node_modules/import-in-the-middle/hook.js:304:21)
    at async load (/Users/andras/Developer/OSS/express-template/node_modules/import-in-the-middle/hook.js:319:26)
    at async nextLoad (node:internal/modules/esm/hooks:746:22)
    at async Hooks.load (node:internal/modules/esm/hooks:383:20)
    at async handleMessage (node:internal/modules/esm/worker:199:18) {
  cause: Error: Unexpected import statement in CJS module.
    at @:2:8
      at esmSyntaxErr (/Users/andras/Developer/OSS/express-template/node_modules/cjs-module-lexer/lexer.js:1153:24)
      at throwIfImportStatement (/Users/andras/Developer/OSS/express-template/node_modules/cjs-module-lexer/lexer.js:1183:13)
      at parseSource (/Users/andras/Developer/OSS/express-template/node_modules/cjs-module-lexer/lexer.js:113:13)
      at parseCJS (/Users/andras/Developer/OSS/express-template/node_modules/cjs-module-lexer/lexer.js:43:5)
      at getCjsExports (/Users/andras/Developer/OSS/express-template/node_modules/import-in-the-middle/lib/get-exports.js:37:20)
      at getExports (/Users/andras/Developer/OSS/express-template/node_modules/import-in-the-middle/lib/get-exports.js:100:12)
      at async /Users/andras/Developer/OSS/express-template/node_modules/import-in-the-middle/lib/get-exports.js:48:28
      at async Promise.all (index 0)
      at async getCjsExports (/Users/andras/Developer/OSS/express-template/node_modules/import-in-the-middle/lib/get-exports.js:40:5)
      at async /Users/andras/Developer/OSS/express-template/node_modules/import-in-the-middle/lib/get-exports.js:48:28 {
    code: 'ERR_LEXER_ESM_SYNTAX',
    loc: 27
  }
}
TypeError [ERR_INVALID_RETURN_PROPERTY_VALUE]: Expected string, array buffer, or typed array to be returned for the "source" from the "load" hook but got undefined.
    at assertBufferSource (node:internal/modules/esm/translators:125:9)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:160:3)
    at callTranslator (node:internal/modules/esm/loader:439:14)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:445:30) {
  code: 'ERR_INVALID_RETURN_PROPERTY_VALUE'
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Jul 9, 2024
@github-actions github-actions bot added the Package: node Issues related to the Sentry Node SDK label Jul 9, 2024
@chargome
Copy link
Member

chargome commented Jul 9, 2024

@AbhiPrasad @timfish could you guys take a look at this?
Thank you!

@timfish
Copy link
Collaborator

timfish commented Jul 9, 2024

If you update to [email protected] this should be fixed. You can do that by removing your lock file and reinstalling your dependencies or I think npm update import-in-the-middle should do it.

@vpmedia
Copy link
Author

vpmedia commented Jul 9, 2024

@timfish Thanks, updating import-in-the-middle to v1.9.0 resolved the issue.

@vpmedia vpmedia closed this as completed Jul 9, 2024
@AbhiPrasad AbhiPrasad added this to the v8 Instrumentation Issues milestone Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: node Issues related to the Sentry Node SDK Type: Bug
Projects
Archived in project
Development

No branches or pull requests

4 participants