Has anyone managed to get Prisma running in Docker...
# orm-help
f
Has anyone managed to get Prisma running in Docker on a AWS EC2 Graviton instance? My Dockerfile looks like this:
Copy code
# To reduce the image size we use a multi-stage build approach, see <https://bit.ly/3vMZjNu>.
### First stage ###
FROM node:lts AS builder

RUN apt-get install -y curl openssl

WORKDIR /app

COPY ./yarn.lock ./package.json ./

RUN yarn install --frozen-lockfile

COPY . .

RUN yarn prisma:generate
RUN yarn build

RUN npm prune --production

####################

### Second stage ###
FROM alpine:3.14.0

RUN apk add --update nodejs

RUN addgroup -S node && adduser -S node -G node

USER node

WORKDIR /home/node/app

COPY --from=builder --chown=node:node /app ./

EXPOSE 3000

CMD ["node", "dist/src/main.js"]
The error message is:
Copy code
UnhandledPromiseRejectionWarning: Error: Unknown PRISMA_QUERY_ENGINE_LIBRARY undefined. Possible binaryTargets: darwin, darwin-arm64, debian-openssl-1.0.x, debian-openssl-1.1.x, rhel-openssl-1.0.x, rhel-openssl-1.1.x, linux-arm64-openssl-1.1.x, linux-arm64-openssl-1.0.x, linux-arm-openssl-1.1.x, linux-arm-openssl-1.0.x, linux-musl, linux-nixos, windows, freebsd11, freebsd12, openbsd, netbsd, arm, native or a path to the query engine library.
You may have to run prisma generate for your changes to take effect.
    at Object.getPlatform (/home/node/app/node_modules/@prisma/client/runtime/index.js:36103:13)
    at async Object.instantiateLibrary (/home/node/app/node_modules/@prisma/client/runtime/index.js:36094:21)
But I have already tried setting
binaryTargets
to different values, e.g.
debian-openssl-1.1.x
for ubuntu 20.04 Unfortunately, nothing helped. Does anyone have a tip?
n
Hey 👋 Did you try adding “native” and “rhel-openssl-1.0.x” to binaryTargets? Like this:
Copy code
binaryTargets = ["native", "rhel-openssl-1.0.x"]
I am not exactly sure which runtime does EC2 graviton instance uses but for lambda functions we have to specify the above 2 targets as mentioned in reference here, can you check it adding these binary targets work?
f
Thanks for the answer! I have now tried the
rhel-openssl-1.0.x
,
debian-openssl-1.1.x
and
linux-arm64-openssl-1.1.x
with
native
, unfortunately none of the three works. According to the documentation, I would have expected
debian-openssl-1.1.x
to work, since I run the Docker instance on ubuntu. As a second, I would have expected
linux-arm64-openssl-1.1.x
to work, since it runs the Linux on
arm64
or to be more precise on
aarch64
. Then there are the versions with openssl 1.0.x, but I use the version 1.1.1n of openssl. Therefore 1.0.x should not be an option. According to the documentation there is also no other build-target that comes into question. https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#binarytargets-options
I’ll try the best candidates from this list: darwin, darwin-arm64, debian-openssl-1.0.x, debian-openssl-1.1.x, rhel-openssl-1.0.x, rhel-openssl-1.1.x, linux-arm64-openssl-1.1.x, linux-arm64-openssl-1.0.x, linux-arm-openssl-1.1.x, linux-arm-openssl-1.0.x, linux-musl, linux-nixos, windows, freebsd11, freebsd12, openbsd, netbsd, arm, native or a path to the query engine library.
According to this error message, it looks like a waste of time because native should be enough.
Copy code
Warning: Your current platform `linux-arm64-openssl-1.1.x` is not included in your generator's `binaryTargets` configuration ["arm"].
    To fix it, use this generator config in your schema.prisma:
    generator client {
  provider      = "prisma-client-js"
  binaryTargets = ["native", "arm"]
}
    Note, that by providing `native`, Prisma Client automatically resolves `linux-arm64-openssl-1.1.x`.
    Read more about deploying Prisma Client: <https://github.com/prisma/prisma/blob/main/docs/core/generators/prisma-client-js.md>
n
Could you create a GitHub Issue here? I also think native should be able to resolve the platform automatically which isn’t happening in this case.
f
Thank you I have created the issue, see https://github.com/prisma/prisma/issues/13073. With the instructions the bug should be easy to reproduce.
🙌 1