P
Prisma3mo ago
kittycat

Prisma not working on Vercel. Missing engine error

Hi, I am trying to deploy my web app on vercel but I am currently getting
Error [PrismaClientInitializationError]:
Invalid `prisma.loans.findMany()` invocation:


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 "lib/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/lib/generated/prisma
/var/task/.next/server
/vercel/path0/lib/generated/prisma
/var/task/.prisma/client
/tmp/prisma-engines
at hE.handleRequestError (.next/server/app/page.js:115:8125)
at hE.handleAndLogRequestError (.next/server/app/page.js:115:6886)
at hE.request (.next/server/app/page.js:115:6593)
at async e (.next/server/app/page.js:127:7467)
at async j (.next/server/app/page.js:136:3442)
at async m (.next/server/app/page.js:1:6567) {
clientVersion: '6.16.0',
errorCode: undefined,
digest: '2479025471'
}
Error [PrismaClientInitializationError]:
Invalid `prisma.loans.findMany()` invocation:


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 "lib/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/lib/generated/prisma
/var/task/.next/server
/vercel/path0/lib/generated/prisma
/var/task/.prisma/client
/tmp/prisma-engines
at hE.handleRequestError (.next/server/app/page.js:115:8125)
at hE.handleAndLogRequestError (.next/server/app/page.js:115:6886)
at hE.request (.next/server/app/page.js:115:6593)
at async e (.next/server/app/page.js:127:7467)
at async j (.next/server/app/page.js:136:3442)
at async m (.next/server/app/page.js:1:6567) {
clientVersion: '6.16.0',
errorCode: undefined,
digest: '2479025471'
}
I check the vercel sources and libquery_engine-rhel-openssl-3.0.x.so.node exists
No description
2 Replies
Prisma AI Help
Prisma AI Help3mo ago
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:
import { PrismaPlugin } from '@prisma/nextjs-monorepo-workaround-plugin'

export default {
webpack: (config, { isServer }) => {
if (isServer) config.plugins.push(new PrismaPlugin())
return config
},
}
import { PrismaPlugin } from '@prisma/nextjs-monorepo-workaround-plugin'

export default {
webpack: (config, { isServer }) => {
if (isServer) config.plugins.push(new PrismaPlugin())
return 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!
kittycat
kittycatOP3mo ago
Note: 2nd option worked

Did you find this page helpful?