Prisma Client could not locate the Query Engine for runtime "rhel-openssl-3.0.x" error on deployment
Prisma works locally and I can invoke my server actions without any problem. However, when I deploy, I get
Unhandled Rejection: Error [PrismaClientInitializationError]: Prisma Client could not locate the Query Engine for runtime "rhel-openssl-3.0.x".
We detected that you are using Next.js, learn how to fix this: https://pris.ly/d/engine-not-found-nextjs.
This is likely caused by a bundler that has not copied "libquery_engine-rhel-openssl-3.0.x.so.node" next to the resulting bundle.
Ensure that "libquery_engine-rhel-openssl-3.0.x.so.node" has been copied next to the bundle or in "generated/prisma".
We would appreciate if you could take the time to share some information with us.
Please help us by answering a few questions: https://pris.ly/engine-not-found-bundler-investigation
The following locations have been searched:
/var/task/generated/prisma
/var/task/.next/server
/vercel/path0/generated/prisma
/var/task/.prisma/client
/tmp/prisma-engines
at yl (.next/server/chunks/546.js:64:756)
at async Object.loadLibrary (.next/server/chunks/546.js:111:10410)
at async Gr.loadEngine (.next/server/chunks/546.js:112:448)
at async Gr.instantiateLibrary (.next/server/chunks/546.js:111:13913) {
clientVersion: '6.6.0',
errorCode: undefined
}
Node.js process exited with exit status: 128. The logs above can help with debugging the issue.
error. generator client {
provider = "prisma-client-js"
output = "../generated/prisma"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
}
"scripts": {
"dev": "next dev",
"build": "prisma generate && next build",
"start": "next start",
"lint": "next lint"
},
"prisma": {
"seed": "ts-node --compiler-options {"module":"commonjs"} prisma/seed.ts"
}
and i am using prisma 6.6.0 in nextjs 15.3.1. I am deploying it to vercel and it builds without any problem.1 Reply
You opted for speed from this bot. Let's conjure up an answer right now!
This is a common issue when deploying Prisma applications to Vercel. The error occurs because the Prisma query engine binary for the deployment environment (rhel-openssl-3.0.x) cannot be found.
To fix this issue, you need to:
1. Add the correct
binaryTargets
to your schema.prisma file:
2. Install and use the Prisma NextJS monorepo workaround plugin:
3. Update your next.config.js/ts to include the plugin:
This solution has been confirmed to work by users facing the same issue with Prisma 6.6.0 on Vercel deployments as seen in this GitHub issue.
The plugin helps ensure that the Prisma query engine binary is properly included in the Vercel deployment bundle. Without this, Next.js bundling can sometimes miss including the necessary binary files.
After making these changes, redeploy your application and the error should be resolved.
GitHub Issue #26966 provides more context on this specific issue with Prisma 6.6.0.