PrismaClientInitializationError

Hi everyone, I am running a Prisma app with Docker and getting this error when the container runs:
PrismaClientInitializationError: Prisma Client could not locate the Query Engine for runtime "linux-musl-openssl-3.0.x".
This happened because Prisma Client was generated for "darwin", but the actual deployment required "linux-musl-openssl-3.0.x".
Add "linux-musl-openssl-3.0.x" to `binaryTargets` in the "schema.prisma" file and run `prisma generate` after saving it:
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
}
PrismaClientInitializationError: Prisma Client could not locate the Query Engine for runtime "linux-musl-openssl-3.0.x".
This happened because Prisma Client was generated for "darwin", but the actual deployment required "linux-musl-openssl-3.0.x".
Add "linux-musl-openssl-3.0.x" to `binaryTargets` in the "schema.prisma" file and run `prisma generate` after saving it:
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
}
I found this (https://github.com/prisma/prisma/issues/8478) Issue on GitHub which goes into this problem however I've attempted all of the suggestions in the entire thread and I'm still getting the error. Here is my current configuration: docker-compose.yaml
auth:
platform: linux/amd64
container_name: auth_api
build:
context: ./backend
dockerfile: auth/Dockerfile
env_file: .env
ports:
- "4000:3000"
volumes:
- "./backend/auth:/usr/src/app/"
- "auth_api:/usr/src/app/node_modules"
volumes:
auth_api:
auth:
platform: linux/amd64
container_name: auth_api
build:
context: ./backend
dockerfile: auth/Dockerfile
env_file: .env
ports:
- "4000:3000"
volumes:
- "./backend/auth:/usr/src/app/"
- "auth_api:/usr/src/app/node_modules"
volumes:
auth_api:

Dockerfile
FROM node:18-alpine

WORKDIR /usr/src/app

COPY ./auth/package*.json ./

COPY prisma ./prisma

RUN npm install

RUN npx prisma generate

COPY ./auth .

EXPOSE 3000 3000

CMD ["./startup"]
FROM node:18-alpine

WORKDIR /usr/src/app

COPY ./auth/package*.json ./

COPY prisma ./prisma

RUN npm install

RUN npx prisma generate

COPY ./auth .

EXPOSE 3000 3000

CMD ["./startup"]
Prisma Schema
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
}
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
}
I've attempted all the solutions from previous comments, I even tried using "linux-musl-arm64-openssl-3.0.x" instead of "linux-musl-openssl-3.0.x" as suggested from someone in the GitHub thread.
GitHub
Precompiled engine files for aarch64-unknown-linux-musl target (A...
Problem Right now you can't use Prisma on Docker alpine on M1 mac as it requires aarch64-unknown-linux-musl binaries. As M1 will see more adoption, people will run into this frequently. Suggest...
0 Replies
No replies yetBe the first to reply to this messageJoin