PrismaClientInitializationError – Missing Query Engine Binary for rhel-openssl-1.0.x on Vercel
Hello,
I'm encountering a PrismaClientInitializationError that started recently. Everything was working perfectly yesterday, but now I'm getting an error at runtime when deploying on Vercel.
To resolve it, I tried updating my Prisma schema with the following:
However, that didn’t resolve the issue. What’s particularly interesting is that I have two projects deployed on Vercel, both using the same Prisma generator configuration and connecting to the same database. The other project works perfectly without specifying binaryTargets, but this one suddenly stopped working as of yesterday.
4 Replies
You opted for speed from this bot. Let's conjure up an answer right now!
Information about Prisma Schema, Client Queries and Environment:
OS: Vercel environment
Database: MongoDB
Node.js version: 18.x in Vercel
Vercel environment (using prisma -v)
Your error,
The error message and several reports indicate that the problem is often due to the bundler or deployment pipeline not copying the
This is not usually a problem with your
PrismaClientInitializationError: Prisma Client could not locate the Query Engine for runtime "rhel-openssl-1.0.x", is a common deployment issue on Vercel and other serverless platforms. This typically happens when the required query engine binary is not present in the deployment output, even if you specify the correct binaryTargets in your schema.prisma.
Key points and solutions from the knowledge sources:
1. Binary Not Copied by Bundler/Deployment Tooling:The error message and several reports indicate that the problem is often due to the bundler or deployment pipeline not copying the
libquery_engine-*.so.node file to the correct location in the deployed bundle. This is especially common when using custom output paths or monorepo setups, or when using frameworks like Next.js or custom build tools. Simply specifying binaryTargets is not always enough, as the deployment process must also ensure the binary is included in the output directory searched at runtime Can't find prisma binary on vercel serverless function.
2. Workarounds and Fixes:
- Remove custom output (if set): Some users found that removing the custom output path from the generator block in schema.prisma allowed Vercel to find the engine binary, as the default output is better supported by the deployment pipeline Can't find prisma binary on vercel serverless function.
- Use the @prisma/nextjs-monorepo-workaround-plugin: If you are using Next.js or a monorepo, adding this plugin to your next.config.js/next.config.mjs ensures the engine binary is copied correctly:
prisma 6.6.0 on vercel - could
not locate the Query Engine for runtime "rhel-openssl-3.0.x"
- Double-check your build scripts: Ensure prisma generate runs as part of your build or postinstall process so the binaries are generated for the correct platform.
3. Other Considerations:
- If you use a custom output directory, make sure the deployment process copies all files from that directory.
- If you recently updated Prisma or your deployment tooling, changes in how files are bundled or copied could cause this issue.
Summary:This is not usually a problem with your
binaryTargets setting, but rather with the deployment pipeline not copying the engine binary to the right place. Try removing custom output paths, using the workaround plugin if on Next.js, and ensure your build process runs prisma generate and copies all necessary files. If the issue persists, check the engine-not-found-nextjs guide for more details.
If you need more targeted help, please share your project structure and build/deployment configuration.
🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly.
In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.Continuing conversation here:
https://github.com/prisma/prisma/discussions/27485
GitHub
PrismaClientInitializationError – Missing Query Engine Binary for...
Question Hello, I'm encountering a PrismaClientInitializationError that started recently. Everything was working perfectly yesterday, but now I'm getting an error at runtime when deploying ...