problem :
when generating prisma client on mac os or windows and deploying to linux machine the result engine works on the native machine , but when deployed it gives the ambiguous error : Exception: Prisma binary query engine not ready .
inspection :
after trying a lot of things to try to identify the problem I inspected that the problem is with file architecture , so I tired two solutions :
First try :
I tried to compile linux architecture in macOS locally so it will be deployed automatically with my dart_frog api docker image to google cloud run , i used :
generator client {
provider = "dart run orm"
binaryTargets = ["native" , "linux-musl"]
}
and it downloaded the linux binaries and generated the engine but didn't work when deployed 🤷🏻♂️
second try :
I tried to modify the docker file to install npx and generate the prisma engine on the deployed docker image itself as follows
# install node and npm
RUN apt-get update && apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup_21.x | bash -
RUN apt-get install -y nodejs
# install npm packages
RUN npm install
RUN npx prisma generate
but it results in the following error :
> [build 12/12] RUN npx prisma generate:
0.465 node:fs:581
0.465 return binding.open(
0.465 ^
0.465
0.465 Error: ENOENT: no such file or directory, open '/app/node_modules/.bin/prisma_schema_build_bg.wasm'
0.465 at Object.openSync (node:fs:581:18)
0.465 at Object.readFileSync (node:fs:460:35)
0.465 at /app/node_modules/.bin/prisma:16:12782
0.465 at /app/node_modules/.bin/prisma:2:355
0.465 at Object.<anonymous> (/app/node_modules/.bin/prisma:242:122)
0.465 at Module._compile (node:internal/modules/cjs/loader:1378:14)
0.465 at Module._extensions..js (node:internal/modules/cjs/loader:1437:10)
0.465 at Module.load (node:internal/modules/cjs/loader:1212:32)
0.465 at Module._load (node:internal/modules/cjs/loader:1028:12)
0.465 at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:142:12) {
0.465 errno: -2,
0.465 code: 'ENOENT',
0.465 syscall: 'open',
0.465 path: '/app/node_modules/.bin/prisma_schema_build_bg.wasm'
0.465 }
0.465
0.465 Node.js v21.6.2
------
Dockerfile:29
--------------------
27 | # install npm packages
28 | RUN npm install
29 | >>> RUN npx prisma generate
30 |
31 | # Build minimal serving image from AOT-compiled `/server` and required system
--------------------
ERROR: failed to solve: process "/bin/sh -c npx prisma generate" did not complete successfully: exit code: 1
problem :
when generating prisma client on mac os or windows and deploying to linux machine the result engine works on the native machine , but when deployed it gives the ambiguous error :
Exception: Prisma binary query engine not ready.inspection :
after trying a lot of things to try to identify the problem I inspected that the problem is with file architecture , so I tired two solutions :
First try :
I tried to compile linux architecture in macOS locally so it will be deployed automatically with my dart_frog api docker image to google cloud run , i used :
and it downloaded the linux binaries and generated the engine but didn't work when deployed 🤷🏻♂️
second try :
I tried to modify the docker file to install npx and generate the prisma engine on the deployed docker image itself as follows
but it results in the following error :