Prisma not working on Vercel. Missing engine error
Hi, I am trying to deploy my web app on vercel but I am currently getting
I check the vercel sources and
libquery_engine-rhel-openssl-3.0.x.so.node exists
2 Replies
You opted for speed from this bot. Let's conjure up an answer right now!
This error means the Prisma query engine file isn’t getting bundled to the place your deployed function expects. On Vercel/Next.js this commonly happens with monorepos, custom client output paths, or Turbopack.
Try these fixes (in order):
1) Regenerate the client during build
- Add: "postinstall": "prisma generate" to your app’s package.json. [Build config]
2) Avoid custom output (temporarily)
- If you set generator client.output = "lib/generated/prisma", remove it and let Prisma use the default path, then redeploy. Several reports show custom output causes Vercel to miss engines. [22142 comments]
3) Include the engine when using monorepos/custom output
- Install and enable the Prisma workaround plugin in next.config:
This ensures Vercel copies libquery_engine-rhel-openssl-3.0.x.so.node into the deployed bundle. [Build config; 26966; 22142 comments]
4) If still failing with Turbopack
- Switch to Webpack (remove --turbopack) and use the plugin above; users report Turbopack misses the engine. [Discussion 27791; 22142 comments]
5) If not Next.js (custom adapters)
- Manually copy the .so.node next to the server bundle or point PRISMA_QUERY_ENGINE_LIBRARY to it. This is needed for some non-Next Vercel setups. [26831]
6) Ensure
correct binary target
- Add binaryTargets = ["native", "rhel-openssl-3.0.x"] and run prisma generate. [26966]
Summary for your case (custom output at lib/generated/prisma):
- Keep your custom output OR remove it. If you keep it, add the PrismaPlugin as above and ensure postinstall runs prisma generate. This combination has unblocked multiple Vercel deploys. [Build config; 26966]
✅ Great, thanks for letting us know that this solved your question!
Note: 2nd option worked