-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query engine library for current platform "linux-musl" could not be found in Docker #16901
Comments
Change Alpine 3.17 moved to OpenSSL 3.0 and that is now the tagged version for Alternatively, install the openssl1.1-compat package with 3.17. Prisma on Alpine w/ OpenSSL 3.0 is not ready yet: #16553 |
Hi, thanks for your answer. I've tried the solutions proposed in the tagged discussion. First I got indeed an error about openSSL, but after I tried both Even after explicity specifying the binaryTargets it keeps throwing errors. Not sure if it's still related to that openSSL package, or something else is wrong here. I also have to note that I saw somewhere that installing |
I also tested building on github actions just now (of which I'm sure it's the same architecture as where I deploy the app), and I get exactly the same error. So now I'm not even sure that it's architecture related... |
TL;DRI did some more research, and to me it seems that it's looking for the 'query engine library' in the wrong location. ContextI use a Next I tried building the docker without pruning, and the binary engine was there in the root These are the places Prisma look:
The location I'm referring to when I mean When I physically check in terminal inside the docker I can find the engine lib but it's not at that location, it's here: But it's not looking there. When diving deeper into these engine locations, I found an environment variable that can be set for where to find each binary, including the missing I found the environment variable Though I tried setting it to Now I'm stuck again. I've set the environment variable, double checked it's effectively set, but still it doesn't seem to look at that location. Maybe it does, but at least the issue remains the same, and the location of the environment variable isn't added to the list Prisma prints out where it's looking. EDIT: In the meantime I also tried adding a symbolic link that points the first location where Prisma looks |
Hi @jclaessens97, can you please share your It looks like you've modified the I've also tried running
but I can see that the query engine library downloaded is called |
Hi @jkomyno, I've indeed tried with modifying
I can't post my full schema, but the generator/datasource blocks looks like this:
My The error happens during client initialization, the first time I try to execute a query. Not during build/generate stage. |
@jclaessens97 can you please copy your project in another folder, replacing your private schema with generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgres"
url = env("DATABASE_URL")
}
model SomeUser {
id Int @id
post Post[]
}
model Post {
id Int @id
user SomeUser @relation(fields: [userId], references: [id])
userId Int
} and trying again to initialise the Client with You may use a Client seed file like the following: // ./prisma/seed.ts
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
async function main() {
/* truncate tables */
await prisma.post.deleteMany()
await prisma.someUser.deleteMany()
// create users
const N_USERS = 2
const userIds = Array.from({ length: N_USERS }, (_, i) => i + 1)
// create posts per user
const N_POSTS_PER_USER = 100
const postsToCreate = Array.from({ length: N_USERS * N_POSTS_PER_USER }, (_, i) => ({
id: i + 1,
userId: Math.floor(i / N_POSTS_PER_USER) + 1
}))
console.log('creating users...')
await prisma.someUser.createMany({
data: userIds.map((id) => ({ id })),
})
console.log('creating posts...')
await prisma.post.createMany({
data: postsToCreate,
})
}
main()
.finally(() => {
prisma.$disconnect()
}) which, when paired with a {
"name": "@prisma/linux-alpine-3.17-x64-openssl-1.1.x",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"@prisma/client": "4.8.0"
},
"prisma": {
"seed": "pnpm ts-node ./prisma/seed.ts"
},
"devDependencies": {
"@types/node": "^18.0.0",
"prisma": "4.8.0",
"ts-node": "^10.8.1",
"typescript": "^4.9.3"
}
} can be run via |
FWIW, I ran into this problem running docker-compose locally with |
@jkomyno, I've looked into trying the repro you suggested and tested it both locally and on AWS. Both seem to work fine on @jcamden I've tried pinning both 3.16, 3.17 (as of 4.8.0 you can again use alpine 3.17 without openssl1.1-compat install). I think my issue is something else. |
I was just able to reproduce it also outside of Docker, however it might be related to my build step and there is no "actual" prisma issue related to the engine not being found, but rather a very confusing error message. I've pushed my reproduction (built on @jkomyno's proposed repro) to github: https://github.com/jclaessens97/prisma-repro My guess is that when building with esbuild (I also have to add the postBuild step to place the schema in my build folder, otherwise it's complaining it can't find the schema), that some files are getting moved around (or not) and that it tries to reach some nescessary files using some sort of relative path. However, I'm not sure which files, where I'm going wrong and how to fix it. On the other side if this IS the case (still not 100%), then I think Prisma can benefit from more clearer error messages 😄 |
Thanks for your repro @jclaessens97, this will be absolutely helpful for understanding this problem on our end! |
@jkomyno no worries, anything to help 😄 I think it might simply be fixed by not using |
I've removed my path aliases for now to work around that. It seems to be working now 🙏 I think it still might be a good thing to have troubleshooting somewhere in the docs with a few steps people can try?
I think that will save you guys a lot of new issues related to this topic 😅 For me you can close this issue! |
I had the same problem and struggled with it for a day. I want to share my experience with those looking for a solution if their setup is like mine. I tried to bundle my app using |
Closing this as the issue has a clear solution here. |
We may remove these fixes in future and allow developers to resolve these issues themselves through custom docker files. For now though, they have no impact on projects that aren't running prisma. Related issues can be found here: - prisma/docs#4365 - prisma/prisma#16901 (comment)
I was able to resolve this after a bit of poking around. More info below. Was getting this error after a
Some info on my local setup:
Build command is:
DockerfileFROM node:18.16-alpine3.17 AS builder
ARG NODE_ENV=production
ARG GH_NODE_AUTH_TOKEN
WORKDIR /home/node/app
# Git is used in later scripts
# Other packages needed for ARM chip if building image locally. For example, on Apple M1
# See https://github.com/parcel-bundler/watcher/issues/102#issuecomment-1229125545
RUN apk add --no-cache \
git \
make \
clang \
build-base \
python3
# Enable yarn
RUN corepack enable
COPY . .
# Install packages
RUN yarn install --immutable --immutable-cache
# Run unit tests
RUN CI=true yarn test
# Do production build
RUN yarn run build
FROM node:18.16-alpine3.17 AS final
ENV NODE_ENV=production
ENV TZ=America/New_York
WORKDIR /home/node/app
# Tini is a container init system
# See https://github.com/krallin/tini
RUN apk add --no-cache tini
# Fix permissions
RUN chown node: /sbin
RUN chown node: /usr/local/bin
USER node
# Only copy needed files
COPY --from=builder --chown=node:node /home/node/app/dist /home/node/app/dist
COPY --from=builder --chown=node:node /home/node/app/generatedInfo.json /home/node/app/generatedInfo.json
COPY --from=builder --chown=node:node /home/node/app/schema.graphql /home/node/app/schema.graphql
EXPOSE 4001
ENTRYPOINT [ "/sbin/tini", "--" ]
CMD [ "node", "/home/node/app/dist/index.js" ] To fix, had to specify the generator client {
provider = "prisma-client-js"
engineType = "binary"
} |
Hi @zach-betz-hln, what if you remove |
Hi @jkomyno - Sure enough, if I change my build command to a plain Though, I'm satisfied with my current |
Adding below line in
|
At
After that, run |
In my situation, I checked the node_modules/.prisma/client folder and I realized that I had a windows .dll instead of the |
@gabo71096 if it helps, yarn version 4 has config options for |
Thanks! I had no idea... Cheers! |
After circling on this page for 3+ hours, for anyone using nextjs, this solved my issues |
According to prisma/prisma#16901 (comment) prisma works only in alpine-3.16 versions
According to prisma/prisma#16901 (comment) prisma works only in alpine-3.16 versions
for me, it was justs a conflict between my local ( |
node:20.18.1-alpine3.20 include OpenSSL |
Whenever I try to run my docker container on AWS App Runner I get the following:
When running my docker container locally it just works. I'm running the docker on AWS on amd64, while on my laptop it's arm64 (m1 mac).
The text was updated successfully, but these errors were encountered: