Skip to content
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

OpenSSL on Node Alpine still not working after Prisma 4.8.0 on an ARM machine #16963

Closed
Geczy opened this issue Dec 21, 2022 · 7 comments
Closed
Milestone

Comments

@Geczy
Copy link

Geczy commented Dec 21, 2022

Bug description

unfortunately still having this issue on macbook m1 and building on docker with node alpine @jkomyno

https://github.com/dotabod/backend/blob/master/web/Dockerfile

https://github.com/dotabod/backend/blob/master/docker-compose.yml

https://github.com/dotabod/backend/blob/master/twitch-chat-listener/prisma/mongo.prisma

 => CACHED [backend-web deps 2/7] RUN apk add yarn git python3 make g++                                                                          0.0s
 => CACHED [backend-web deps 3/7] WORKDIR /app                                                                                                   0.0s
 => CACHED [backend-twitch-chat-listener deps 4/7] COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./                            0.0s
 => [backend-twitch-chat-listener deps 5/7] COPY prisma ./prisma                                                                                 0.2s
 => CACHED [backend-web deps 4/7] COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./                                             0.0s
 => [backend-web deps 5/7] COPY prisma ./prisma                                                                                                  0.3s
 => ERROR [backend-twitch-chat-listener deps 6/7] RUN yarn --frozen-lockfile                                                                    20.2s
 => CANCELED [backend-web deps 6/7] RUN yarn --frozen-lockfile                                                                                  21.5s
------                                                                                                                                                
 > [backend-twitch-chat-listener deps 6/7] RUN yarn --frozen-lockfile:                                                                                
#0 0.449 yarn install v1.22.5                                                                                                                         
#0 0.536 [1/4] Resolving packages...                                                                                                                  
#0 0.725 [2/4] Fetching packages...                                                                                                                   
#0 10.11 info fsevents@2.3.2: The platform "linux" is incompatible with this module.                                                                  
#0 10.11 info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.                              
#0 10.12 [3/4] Linking dependencies...                                                                                                                
#0 11.92 [4/4] Building fresh packages...                                                                                                             
#0 17.98 $ prisma generate --schema ./prisma/mongo.prisma && prisma generate --schema ./prisma/postgres.prisma                                        
#0 19.16 Prisma schema loaded from prisma/mongo.prisma                                                                                                
#0 19.43 Error: Unable to establish a connection to query-engine-node-api library. It seems that the current architecture arm64 is not supported, or that libc is missing from the system.
#0 19.43 Details: Unable to require(`/app/node_modules/prisma/libquery_engine-linux-arm64-openssl-1.1.x.so.node`)
#0 19.43  Error loading shared library ld-linux-aarch64.so.1: No such file or directory (needed by /app/node_modules/prisma/libquery_engine-linux-arm64-openssl-1.1.x.so.node)
#0 19.43 [Context: getDmmf]
#0 19.43 
#0 19.43 Prisma CLI Version : 4.8.0
#0 19.49 error Command failed with exit code 1.
#0 19.49 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
------
failed to solve: executor failed running [/bin/sh -c yarn --frozen-lockfile]: exit code: 1
error: Recipe `build` failed on line 27 with exit code 17

How to reproduce

Run docker compose up from https://github.com/dotabod/backend

Expected behavior

Should work !

Prisma information

https://github.com/dotabod/backend/blob/master/twitch-chat-listener/prisma/mongo.prisma

Environment & setup

  • OS: macOS M1
  • Database: Prisma using psql and mongo
  • Node.js version: 16.2 from dokcer

Prisma Version

this is from my host not my docker container

➜  twitch-chat-listener git:(master) yarn prisma -v
yarn run v1.22.19
$ /Users/matt/backend/twitch-chat-listener/node_modules/.bin/prisma -v
prisma                  : 4.8.0
@prisma/client          : 4.8.0
Current platform        : darwin-arm64
Query Engine (Node-API) : libquery-engine d6e67a83f971b175a593ccc12e15c4a757f93ffe (at node_modules/@prisma/engines/libquery_engine-darwin-arm64.dylib.node)
Migration Engine        : migration-engine-cli d6e67a83f971b175a593ccc12e15c4a757f93ffe (at node_modules/@prisma/engines/migration-engine-darwin-arm64)
Introspection Engine    : introspection-core d6e67a83f971b175a593ccc12e15c4a757f93ffe (at node_modules/@prisma/engines/introspection-engine-darwin-arm64)
Format Binary           : prisma-fmt d6e67a83f971b175a593ccc12e15c4a757f93ffe (at node_modules/@prisma/engines/prisma-fmt-darwin-arm64)
Format Wasm             : @prisma/prisma-fmt-wasm 4.8.0-61.d6e67a83f971b175a593ccc12e15c4a757f93ffe
Default Engines Hash    : d6e67a83f971b175a593ccc12e15c4a757f93ffe
Studio                  : 0.479.0
✨  Done in 2.03s.
@Geczy Geczy added the kind/bug A reported bug. label Dec 21, 2022
@janpio janpio changed the title OpenSSL on Node Alpine still not working after Prisma 4.8.0 OpenSSL on Node Alpine still not working after Prisma 4.8.0 on an ARM machine Dec 21, 2022
@Geczy
Copy link
Author

Geczy commented Dec 21, 2022

i can "fix it" if i do FROM --platform=linux/amd64 node:16.2.0-alpine ... , but it will use 2gb+ memory on the container lol

@aqrln
Copy link
Member

aqrln commented Dec 21, 2022

Thank you for taking the time to report the issue, and sorry for the confusion. Unfortunately the behaviour you are facing is currently expected and it is a completely different issue than what was fixed in 4.8.0. This issue is a duplicate of #8478, so I'm going to go ahead and close it to keep the backlog cleaner.

I can't provide any timeline about when we will officially support Alpine Linux on ARM, but this is something we keep in mind and want to fix. For now your options are:

  1. Build the engines yourself from source on Alpine and point Prisma to your custom engines using the environment variables.
  2. Switch to a Debian-based image (e.g. node:16.2.0-slim).
  3. Use x86_64 image in emulation.
  4. Try to make the ARM64 Debian binaries that we provide work on Alpine with libc6-compat and gcompat — not sure if I should even mentioned it as mostly likely it would end up being waste of time. Besides, you would then probably need a Node.js binary linked with glibc instead of musl too in order to use the library engine.

Out of these options, only (1) and (2) are guaranteed to work, and (2) is the easiest.

Option (3), as you already noticed, is also easy, but comes with an extreme performance and memory cost, and might not work for complex applications. It is usually acceptable for local development (especially on M1 Pro, less so on base M1 models), but absolutely out of question if you deploy on ARM servers of course. If this works for you, then it's a reasonable workaround for now, but if it doesn't, it is also understandable.

Please keep an eye on the linked issue, we will post any updates about support for Alpine on ARM there.

@aqrln aqrln closed this as completed Dec 21, 2022
@Geczy
Copy link
Author

Geczy commented Dec 21, 2022

@aqrln if i use option (3) does it still attempt to emulate when deploying to a prod machine that's already on x84_64 ? ie, can i reuse this same dockerfile for prod?

@aqrln
Copy link
Member

aqrln commented Dec 21, 2022

@Geczy you can reuse it in production, no emulation will happen if the specified platform matches the machine the container is running on. (Besides, Docker on Linux doesn't even have the ability to emulate different CPU architectures out of the box, you would need to use something like https://github.com/multiarch/qemu-user-static if you wanted that).

If you want to avoid modifying the Dockerfile, you can pass --platform=linux/amd64 to docker buildx build command when building the container locally.

@Geczy
Copy link
Author

Geczy commented Dec 21, 2022

ty for your help! you've been great

@djedlajn
Copy link

Is there ETA for alpine ARM support @aqrln. Ik we can build from source but I wonder whats the hurdle is to provide binary for M1 ARM?

@aqrln
Copy link
Member

aqrln commented Feb 6, 2023

ARM support for Alpine will be released in Prisma 4.10.0 tomorrow

@janpio janpio added this to the 4.10.0 milestone Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants