prisma: Query Engine Library Not Found
Bug description
We have recently been seeing query engine library errors on our app hosted on vercel. This has been happening for about a day and suddenly started happening intermittently. This is really weird because it says it wants “rhel-openssl-1.1.x” and that we incorrectly pinned to “rhel-openssl-1.1.x”.
We have tried to explicitely add binaryTargets = ["native", "rhel-openssl-1.0.x", "rhel-openssl-1.1.x"], but this causes our build to fail with function size errors.
I would appreciate any pointers here.
Query engine library for current platform "rhel-openssl-1.1.x" could not be found.
You incorrectly pinned it to rhel-openssl-1.1.x
This probably happens, because you built Prisma Client on a different platform.
(Prisma Client looked in "/var/task/node_modules/@prisma/client/ultron/runtime/libquery_engine-rhel-openssl-1.1.x.so.node")
Searched Locations:
/var/task/node_modules/@prisma/.prisma/client
/vercel/path0/node_modules/@prisma/client/ultron
/var/task/node_modules/@prisma/client/ultron
/var/task/node_modules/@prisma/client/ultron
/var/task/node_modules/@prisma/client/ultron
/tmp/prisma-engines
/var/task/node_modules/@prisma/client/ultron
To solve this problem, add the platform "rhel-openssl-1.1.x" to the "binaryTargets" attribute in the "generator" block in the "schema.prisma" file:
generator client {
provider = "prisma-client-js"
binaryTargets = ["native"]
}
Then run "prisma generate" for your changes to take effect.
Read more about deploying Prisma Client: https://pris.ly/d/client-generator
I see a related issue here: #13266
How to reproduce
It currently seems to cause random requests to error out. I am not able to identify a pattern here.
Expected behavior
I expect the right query engine library to be used.
Prisma information
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["filterJson", "dataProxy"]
output = "../../../../node_modules/@prisma/client/ultron"
}
generator dbml {
provider = "prisma-dbml-generator"
}
Environment & setup
This is currently happening on vercel’s serverless platform which I believe uses AWS.
Prisma Version
prisma : 3.11.1
@prisma/client : 3.11.1
Current platform : darwin-arm64
Query Engine (Node-API) : libquery-engine 1a2506facaf1a4727b7c26850735e88ec779dee9 (at node_modules/prisma/node_modules/@prisma/engines/libquery_engine-darwin-arm64.dylib.node)
Migration Engine : migration-engine-cli 1a2506facaf1a4727b7c26850735e88ec779dee9 (at node_modules/prisma/node_modules/@prisma/engines/migration-engine-darwin-arm64)
Introspection Engine : introspection-core 1a2506facaf1a4727b7c26850735e88ec779dee9 (at node_modules/prisma/node_modules/@prisma/engines/introspection-engine-darwin-arm64)
Format Binary : prisma-fmt 1a2506facaf1a4727b7c26850735e88ec779dee9 (at node_modules/prisma/node_modules/@prisma/engines/prisma-fmt-darwin-arm64)
Default Engines Hash : 1a2506facaf1a4727b7c26850735e88ec779dee9
Studio : 0.458.0
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 7
- Comments: 20 (6 by maintainers)
I think the cause of this issue is that Prisma is not searching the correct directory for the binary.
in my case I am compiling for AWS lambda, I get the error:
looking at the search paths it is missing
The binaries are located here and not in the
@prisma/clientdirectory+1 for @millsp just said. I used Mac M1, and installed Node under Rosetta. Then later I re-installed Node using Arm, started my server with Prisma, and encountered the error
Query engine library for current platform "darwin-arm64" could not be foundThe solution for my case is to re-run
prisma generateunder ArmHey, we wanted to give you an update about this. We have around 10 issues that we have identified to be in the “engine not found” category. Looking at these, we learned that there are four main categories responsible for these errors:
native(default) on one platform, but used on a different platform at runtime.binaryTargetsincorrectly, and the correct engine was therefore not included at runtime.These cases were previously not detected. On top of that, the error messages were confusing and were neither helpful for you or us. With that, it is likely that many of the cases above overlapped each other. So while we cannot fix a missing engine, we can detect how and why it happened. Thanks to that, we now display more useful errors to help you out of trouble. And in some cases, we will ask some input from you to learn more about your project so we can further improve.
If something is still off for you, feel free to create a new issue.
Don’t know whether this helps anyone. But let me share my experience and fix for this error.
Some context:
cockroachone forsqlite.node_modules/.prisma/sqliteandnode_modules/.prisma/cockroach.aws-cdk/aws-lambda-nodejsto package lambdas.node_modules/prismanode_modules/@prisma/engineslibquery_enginefiles generated on the CIIn order to fix the
Query engine library for current platform "rhel-openssl-1.0.x" could not be found.I had to explicitly set thePRISMA_QUERY_ENGINE_LIBRARYenv var for the lambdas to point to the library files.Little specific setup and an ugly solution but it works out in the end.
I’ve tried @VictorArowo’s approach, but still running into issues. Bizarrely, the error is pretty contradictory:
In my particular implementation, I’m using this in a Yarn workspaces monorepo (test repo) with serverless-webpack-prisma. The same monorepo also reuses this Prisma client from a shared package in a Next.js site workspace, and Prisma works fine there, making me think my problem might actually be more specific to serverless-webpack-prisma (I’ve also asked there in this issue.
More detailed error message:
I am getting this error in AWS lambda node16.x
Yes. This is happening intermittently, causing random requests to fail. We never specified binaryTargets in anyway prior to this. And specifying [“native”, “rhel-openssl-1.1.x”] also causes our builds to fail with function size errors. We have temporarily just pinned to binaryTargets = [“rhel-openssl-1.1.x”], but this obviously does not work for local development, as we have to switch to native.