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

import-in-the-middle' failed to wrap 'file:///app/node_modules/@prisma/client/default.js' #116

Closed
IamR3m opened this issue Jun 28, 2024 · 2 comments · Fixed by #108
Closed

Comments

@IamR3m
Copy link

IamR3m commented Jun 28, 2024

Expected Behavior

An app should run successfully

Actual Behavior

Googling points me to this repository.
An app fails with

Error: 'import-in-the-middle' failed to wrap 'file:///app/node_modules/@prisma/client/default.js'
    at getSource (/app/node_modules/import-in-the-middle/hook.js:304:21)
    at async load (/app/node_modules/import-in-the-middle/hook.js:319:26)
    at async nextLoad (node:internal/modules/esm/hooks:864:22)
    at async Hooks.load (node:internal/modules/esm/hooks:447:20)
    at async handleMessage (node:internal/modules/esm/worker:196:18) {
  cause: Error: Unexpected import statement in CJS module.
    at @:1:8
      at esmSyntaxErr (/app/node_modules/cjs-module-lexer/lexer.js:1153:24)
      at throwIfImportStatement (/app/node_modules/cjs-module-lexer/lexer.js:1183:13)
      at parseSource (/app/node_modules/cjs-module-lexer/lexer.js:113:13)
      at parseCJS (/app/node_modules/cjs-module-lexer/lexer.js:43:5)
      at getCjsExports (/app/node_modules/import-in-the-middle/lib/get-exports.js:37:20)
      at getExports (/app/node_modules/import-in-the-middle/lib/get-exports.js:100:12)
      at async /app/node_modules/import-in-the-middle/lib/get-exports.js:48:28
      at async Promise.all (index 0)
      at async getCjsExports (/app/node_modules/import-in-the-middle/lib/get-exports.js:40:5)
      at async /app/node_modules/import-in-the-middle/lib/get-exports.js:48:28 {
    code: 'ERR_LEXER_ESM_SYNTAX',
    loc: 7
  }
}

after updating dependencies and implementing some feature on my code not affecting sentry or prisma.

Steps to Reproduce the Problem

  1. Create ESM project
  2. Install prisma
  3. Install @sentry/node
  4. build and deploy project on Google Cloud Run

Specifications

  • Version: 1.8.1
  • Platform: node:18-alpine on Google Cloud Run
  • Subsystem: NodeJS 18.20.3
@timfish
Copy link
Contributor

timfish commented Jun 28, 2024

There's already an open Sentry issue for this:
getsentry/sentry-javascript#12325

And a PR in this repository to fix it:
#108

@timfish
Copy link
Contributor

timfish commented Jun 28, 2024

Ah, just realised this is actually a duplicate of #97!

@timfish timfish closed this as completed Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants