From the official docs,
Prisma Client consists of three major components.
- JavaScript client library
- TypeScript type definitions
- A query engine (in the form of binary file)
While the generated code is cross platform (this is javascript), the query engine
is not.
When you run the prisma generate
command, prisma seems to uses the query engine
, but it needs to find the proper binary for the current platform otherwise it throws an error.
The problem is for some reason I cannot explain (because I am having the same problem) the platform within the docker is not recognized as a supported platform one.
My guess is either docker is providing the wrong platform or there is a bug in prisma at some point, the error message linux-arm-openssl-undefined
with undefined
in it could possibly be a clue of the problem.
Solution: Right now: I plan running my images on an x86 computer the time for this issue to be fixed. The latest docker 3 RC2 (released 5 days ago) did not help neither.
Note that you can specify binaryTargets into the schema.prisma
file.
generator client {
provider = "prisma-client-js"
binaryTargets = ["debian-openssl-1.1.x"]
}
But for some reason, and even if I am building my docker image on top of a debian, this does not work. Prisma seems to recognize I am on linux-arm
but is unable to associate a binaryTarget to. Also… is this platform really accurate ? Is docker running an linux arm under the hood or an x86 debian under rosetta ? I've no idea.
[EDIT]
node images are Multi-Arch, meaning
FROM node:15.12.0-buster-slim AS builder
Will pick the linux architecture for my host platform (linux/arm64/v8)
It seems we can actually build for x86 on m1 using buildx experimental feature according to this post