Could not locate Query Engine
Repo: https://github.com/DarkstarXDD/interactive-card-details-form
Live site: https://interactive-card-details-form-darkstarxdd.vercel.app/
Prisma Client could not locate the Query Engine for runtime "rhel-openssl-3.0.x".
Hi, I get this error when i deploy the project to Vercel. (Let me know if you need the full error message i can send it)
I have searched online and came across multiple github discussions where others had encountered the same issue with different setups. I tried few solutions mentioned in those but nothing worked. I searched this server as well but there doesn't seem to be an exact solution.
- This issue does not happen in development. I ran npm run build
and tested this with a production version locally and still no errors.
- When deployed to Vercel there are no build errors.
- But at run time when i submit the data through my form and the Prisma query is called, it throws the error.
My setup is extremely simple since it's a small practice project.
- Next.js 15.2.4
, App Router.
- prisma CLI
and @prisma/client 6.6.0
.
- Calling the Prisma query in a Server Action.
- The database is Supabase Postgres.
- Used the new custom path option to define a path in src/genereted/prisma/client
.
- Provider is the old prisma-client-js
.
- I have removed the generated folder from git tracking, and have added prisma generate
in a postinstall
script in the package.json
. So the Prisma Client gets newly generated on the Vercel server during the production build.
- I have followed this guide and created a globalForPrisma
as well. Inside that i directly import the client from the generated output. When in earlier versions i didn't define a custom output i imported from @prisma/client
.
- I have tried adding binaryTargets
as well, but didn't work.9 Replies
You've gone full bot mode! Let me fetch that AI answer for you ASAP.
Hey 👋
What did you add in your
binaryTargets
?
Was it something like this:
Thanks for confirming.
Can you do a quick check and see if the issue exists in prisma version 6.5.0 as well?
We changed a lot of things in version 6.6.0, so I just want to be sure that this error is not related to the changes we did.
Sure i can check.
Should i remove the custom output path and let it create the prisma client inside the
node_modules
?
Or should i just keep everything as it is an only change the version? I am not exactly sure whether the custom output path existed in 6.5.0. From my understanding it was added in version 6.6.0?Should i remove the custom output path and let it create the prisma client inside the node_modules?Yes, you can keep the default behaviour of prisma client inside of node_modules
I didn't switch to 6.5.0, but rather removed the custom output path while still using 6.6.0 and let it create the prisma client inside
node_modules
. And now it works all right. The above error is not present.
So seems like the custom path is causing the issue? I am not sure but since that's the only thing that i changed, it could be something related to that.Hmm! Super strange!
It could be related to custom path. We started recommending usage of custom path in 6.6.0 release, so it can be related
I can see you're encountering the "Query Engine not found" error when deploying your Prisma application to Vercel. This is a common issue when deploying Prisma applications to serverless environments like Vercel.
Based on the knowledge sources, this error occurs because Prisma Client can't find the appropriate query engine binary for the runtime environment on Vercel. When you develop locally, Prisma uses your local machine's binary target, but when deployed to Vercel, it needs a different binary target (rhel-openssl-3.0.x).
Solution Options
1. Add the correct binary target to your schema.prisma file:
This should include both your local environment's binary target ("native") and Vercel's environment binary target ("rhel-openssl-3.0.x"). 2. Use the Prisma NextJS monorepo workaround plugin: Several users in the knowledge sources mentioned success with this approach:
Then in your Next.js config file:
This was specifically mentioned as a solution in this GitHub issue. 3. For Next.js 15 specifically, you might need to use a static copy plugin to ensure the binary files are included in your deployment:
As mentioned in this GitHub issue, you can use a static copy plugin:
Additional Troubleshooting If the above solutions don't work, you might want to: 1. Check if your Vercel deployment is using Node 20, as there were specific issues reported with Node 20 deployments on Vercel in this GitHub issue. 2. Make sure your
This should include both your local environment's binary target ("native") and Vercel's environment binary target ("rhel-openssl-3.0.x"). 2. Use the Prisma NextJS monorepo workaround plugin: Several users in the knowledge sources mentioned success with this approach:
Then in your Next.js config file:
This was specifically mentioned as a solution in this GitHub issue. 3. For Next.js 15 specifically, you might need to use a static copy plugin to ensure the binary files are included in your deployment:
As mentioned in this GitHub issue, you can use a static copy plugin:
Additional Troubleshooting If the above solutions don't work, you might want to: 1. Check if your Vercel deployment is using Node 20, as there were specific issues reported with Node 20 deployments on Vercel in this GitHub issue. 2. Make sure your
postinstall
script is actually running during Vercel deployment. You can check the build logs to confirm.
3. Try explicitly setting the binary path in your PrismaClient initialization:
This issue is quite common with Prisma deployments on serverless platforms, and the Prisma team is aware of it. The upcoming Rust-based version of Prisma might help resolve these deployment issues in the future.