friebetill
04/27/2022, 10:19 PM# 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:
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?Nurul
04/28/2022, 8:38 AMbinaryTargets = ["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?friebetill
04/28/2022, 11:24 AMrhel-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-optionsfriebetill
04/28/2022, 1:19 PMfriebetill
04/28/2022, 1:28 PMWarning: 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>
Nurul
04/28/2022, 1:34 PMfriebetill
04/29/2022, 8:02 AM