Prisma and Netlify, binary is not downloaded automatically since 2.8.0
See original GitHub issueBug description
Since Prisma 2.8.0
the following schema.prisma
configuration doesn’t download the binary in Netlify CI. To clarify, a binary is downloaded if you are running it locally.
generator client {
provider = "prisma-client-js"
binaryTargets = ["native"]
}
How to reproduce
- Deploy this project to netlify https://github.com/divyendu-test/p2-netlify-ci (fulfil the required env var from Netlify UI)
- It is on Prisma version
2.8.0
or later (I also tried it on the latest dev2.10.0-dev.55
) and the service URL after the first deploy should fail with{"errorType":"Error","errorMessage":"\nInvalid `prisma.user.deleteMany()` invocation in\n/var/task/src/functions/index.js:6:21\n\n\n Query engine binary for current platform \"rhel-openssl-1.0.x\" could not be found.\nThis probably happens, because you built Prisma Client on a different platform.\n(Prisma Client looked in \"/var/task/src/node_modules/@prisma/client/runtime/query-engine-rhel-openssl-1.0.x\")\n\nFiles in /var/task/src/node_modules/@prisma/client/runtime:\n\n index.d.ts\n index.js\n index.js.map\n\nYou already added the platform \"native\" to the \"generator\" block\nin the \"schema.prisma\" file as described in https://pris.ly/d/client-generator,\nbut something went wrong. That's suboptimal.\n\nPlease create an issue at https://github.com/prisma/prisma-client-js/issues/new","trace":["Error: ","Invalid `prisma.user.deleteMany()` invocation in","/var/task/src/functions/index.js:6:21","",""," Query engine binary for current platform \"rhel-openssl-1.0.x\" could not be found.","This probably happens, because you built Prisma Client on a different platform.","(Prisma Client looked in \"/var/task/src/node_modules/@prisma/client/runtime/query-engine-rhel-openssl-1.0.x\")","","Files in /var/task/src/node_modules/@prisma/client/runtime:",""," index.d.ts"," index.js"," index.js.map","","You already added the platform \"native\" to the \"generator\" block","in the \"schema.prisma\" file as described in https://pris.ly/d/client-generator,","but something went wrong. That's suboptimal.","","Please create an issue at https://github.com/prisma/prisma-client-js/issues/new"," at qw.request (/var/task/src/node_modules/@prisma/client/runtime/index.js:210:293)"]}
- Change the Prisma CLI/Client version to
2.7.0
and re-deploy - It should work as expected (please do “clear cache and deploy” from netlify UI)
- Note that if you have a project that has the binary already, netlify’s cache might provide the binary, so please use “clear cache and deploy” for trying out each version
Expected behavior
2.8.0
should also download the requirednetlify
binary if2.7.0
does.
Additional context
-
The workaround of adding the specific binary works
generator client { provider = "prisma-client-js" binaryTargets = ["native", "rhel-openssl-1.0.x"] }
-
A sample SQL/Schema that this can be tried with
CREATE TABLE "public"."User" ( "email" text NOT NULL, "id" text NOT NULL, "name" text, PRIMARY KEY ("id") );
datasource db { provider = "postgresql" url = env("NETLIFY_BETA_PG_URL") } generator client { provider = "prisma-client-js" binaryTargets = ["native"] } model User { id String @id @default(cuid()) email String @unique name String? }
-
DM me for database credentials if you are trying this from within Prisma.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Netlify Deployment | Unfound Prisma engine binary
RedwoodJS Tutorial: Netlify Deployment | Unfound Prisma engine ... Prisma and Netlify, binary is not downloaded automatically since 2.8.0.
Read more >Prisma Client Binary Not Copied for Netlify Lambda Functions ...
I'm trying to deploy a GraphQL server using Netlify Functions; my app works in development, but doesn't work in production because the necessary...
Read more >Prisma Client Binary Not Copied for Netlify Lambda Functions ...
Bug description I'm trying to deploy a GraphQL server using Netlify Functions; my app works in development, but doesn't work in production because...
Read more >different outcomes between CLI deployment and github auto ...
I have one project that I can deploy two different ways. The first one works, the second does not. I used netlify functions:create...
Read more >Netlify won't deploy my Next.js+Prisma app
I'm having trouble deploying this basic Next.js app with Prisma to ... Prisma Client Binary Not Copied for Netlify Lambda Functions (For ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Confirming my local and deploy tests (Netlify and Vercel) are successfull using Prisma v2.11.0-dev.40 in the case where binaryTarget = “native”.
Thanks again! 🚀
Fixed by https://github.com/prisma/prisma/commit/f11b24b6e1f23a82fa56eae4119c57a01865f536