I am building a nextjs 13 site on github actions and deploying statically to vercel. It usses prisma and I get this error in the runtime logs from vercel:
2022-12-12T01:07:00.163Z 2022-12-12T01:07:00.196Z 2581999e-981c-4f05-a35d-f6f467934166 INFO PrismaClientInitializationError: Query engine library for current platform "rhel-openssl-1.0.x" could not be found.
2022-12-12T01:07:00.163Z You incorrectly pinned it to rhel-openssl-1.0.x
2022-12-12T01:07:00.163Z
2022-12-12T01:07:00.163Z This probably happens, because you built Prisma Client on a different platform.
2022-12-12T01:07:00.163Z (Prisma Client looked in "/var/task/node_modules/@prisma/client/runtime/libquery_engine-rhel-openssl-1.0.x.so.node")
2022-12-12T01:07:00.163Z
2022-12-12T01:07:00.163Z Searched Locations:
2022-12-12T01:07:00.163Z
2022-12-12T01:07:00.163Z /var/task/node_modules/.prisma/client
2022-12-12T01:07:00.163Z /home/runner/work/project1/project1/node_modules/@prisma/client
2022-12-12T01:07:00.163Z /var/task/node_modules/@prisma/client
2022-12-12T01:07:00.163Z /var/task/node_modules/.prisma/client
2022-12-12T01:07:00.163Z /var/task/node_modules/.prisma/client
2022-12-12T01:07:00.163Z /tmp/prisma-engines
2022-12-12T01:07:00.163Z /var/task/node_modules/.prisma/client
2022-12-12T01:07:00.163Z
2022-12-12T01:07:00.163Z
2022-12-12T01:07:00.163Z To solve this problem, add the platform "rhel-openssl-1.0.x" to the "binaryTargets" attribute in the "generator" block in the "schema.prisma" file:
2022-12-12T01:07:00.163Z generator client {
2022-12-12T01:07:00.163Z provider = "prisma-client-js"
2022-12-12T01:07:00.163Z binaryTargets = ["native", "debian-openssl-3.0.x", "linux-arm64-openssl-1.1.x"]
2022-12-12T01:07:00.163Z }
2022-12-12T01:07:00.163Z
2022-12-12T01:07:00.163Z Then run "prisma generate" for your changes to take effect.
2022-12-12T01:07:00.163Z Read more about deploying Prisma Client: https://pris.ly/d/client-generator
This is what my schema file looks like:
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "debian-openssl-3.0.x", "linux-arm64-openssl-1.1.x", "rhel-openssl-1.0.x"]
}
The only configuration I can find for my runtime on vercel is this:
Anybody know how I can change my github action environment to build for the vercel environment? What even is the vercel environment? I’m building in a runner that uses ubuntu-latest on github
2
Answers
The error makes me think that you need to actually compile the Prisma client in Vercel, and not in GitHub Actions. That way you guarantee that the Prisma client is being compiled for the target platform (Vercel) and not for your CI/CD platform (GitHub Actions.)
These docs might help: https://www.prisma.io/docs/guides/deployment/deployment-guides/deploying-to-vercel#vercel-build-hook
And they point to using this command in your
package.json
for building the client in Vercel:Had the same problem fixed by following the instruction in the error message at added the platform rhel-openssl-1.0.x to the binaryTargets then ran
prisma generate
againIn your case would make sure to add rhel-openssl-1.0.x to the end of the array as you currently have it
Then make sure to run
prisma generate
again