-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Cannot find module '.prisma/client/default' #12325
Comments
This should be fixed by our If the patch works, fix is released with open-telemetry/opentelemetry-js#4745 |
I tried to apply the following patch file using ppm, but still have the same issue.
|
Here is how I import prisma: const require = createRequire(import.meta.url)
const client = require('@prisma/client').PrismaClient as typeof PrismaClient |
Shoot. one last thing to try then, could you override
{
"pnpm": {
"overrides": {
"import-in-the-middle": "^1.8.0",
}
}
} if this doesn't work, it's def another bug we have to look into. We'll investigate and fix asap. Sorry for the trouble. |
It looks like this might be a different bug caused by the CJS evaluation of @P4sca1 is there any reason you're doing this: const require = createRequire(import.meta.url)
const client = require('@prisma/client').PrismaClient as typeof PrismaClient Rather than this? import { PrismaClient } from '@prisma/client' |
Prisma is a CJS package and does not support ESM yet. I think you can't just import CJS packages in an ESM environment, but I will try if it works that way. |
It is |
I think this is the cause: Working on a fix! |
Importing Prisma using |
I've just tested Are you using TypeScript and transpiling to CommonJs? Is there anything else about your setup that might help me reproduce this? |
Here's my tsconfig.json: {
"extends": ["@tsconfig/node-lts", "@tsconfig/strictest"],
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
// Use ESM
"module": "nodenext",
"moduleResolution": "nodenext",
// Use helpers from tslib, instead of inlining them
"noEmitHelpers": true,
"importHelpers": true,
// Generate inline source maps
"sourceMap": true,
"inlineSources": true,
"sourceRoot": "/",
// Don not require exact optional property types. The generated prisma client does not work with it.
"exactOptionalPropertyTypes": false
},
"include": ["src/**/*.ts", "./types/**/*.d.ts"]
} I run {
"scripts": {
"tsc:build": "tsc --project ./tsconfig.json",
"build": "prisma generate && pnpm run tsc:build",
"start": "node --import ./instrument.js ./dist/main.js",
},
"type": "module",
"dependencies": {
"@prisma/client": "5.14.0",
"@sentry/node": "8.7.0",
"@sentry/profiling-node": "8.7.0",
"prisma": "5.14.0",
"tslib": "2.6.2",
},
"devDependencies": {
"@sentry/cli": "2.32.1",
"@swc-node/register": "1.9.0",
"@tsconfig/node-lts": "20.1.3",
"@tsconfig/strictest": "2.0.5",
"typescript": "5.4.5"
},
"packageManager": "pnpm@9.1.4",
"pnpm": {
"overrides": {
"import-in-the-middle": "1.8.0"
}
}
} |
@timfish I created a minimal reproduction here: https://codesandbox.io/p/devbox/sentry-issue-12325-z9jfx7 |
Because prisma is CJS, I think this is fixed by nodejs/import-in-the-middle#96 but I need to confirm |
This should hopefully have been fixed by the numerous PRs recently merged at While we wait for this to be released, there is a patch available that combines all the fixes. If anyone can confirm this patch fixes this issue that would be super helpful! |
The issue persists with |
This is still waiting for this PR to be merged. |
With the newest release of If you upgrade to a fresh install of the latest version of the Node SDK it should use |
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.7.0
Framework Version
No response
Link to Sentry event
No response
SDK Setup
Steps to Reproduce
I migrated my code to Sentry v8 and can no longer start my application. I start my app using
node --import ./instrument.js ./dist/main.js
. I usepnpm
as my package manager.Expected Result
Prisma v8 should work using ESM, pnpm, and prisma.
Actual Result
The text was updated successfully, but these errors were encountered: