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

[BUG] arm64 docker image appears to be broken #550

Open
alexandreteles opened this issue May 4, 2024 · 3 comments
Open

[BUG] arm64 docker image appears to be broken #550

alexandreteles opened this issue May 4, 2024 · 3 comments

Comments

@alexandreteles
Copy link

When running the arm64 image, on a clean volume, the logs will read:

PrismaClientInitializationError: Unable to require(`/opt/lavamusic/node_modules/.prisma/client/libquery_engine-linux-arm64-openssl-1.1.x.so.node`).
Prisma cannot find the required `libssl` system library in your system. Please install openssl and try again.
Details: libssl.so.1.1: cannot open shared object file: No such file or directory
    at Object.loadLibrary (/opt/lavamusic/node_modules/@prisma/client/runtime/library.js:111:10219)
    at async wt.loadEngine (/opt/lavamusic/node_modules/@prisma/client/runtime/library.js:112:448)
    at async wt.instantiateLibrary (/opt/lavamusic/node_modules/@prisma/client/runtime/library.js:111:12778) {
  clientVersion: '5.13.0',
  errorCode: undefined
}
Node.js v20.12.2
prisma:warn Prisma failed to detect the libssl/openssl version to use, and may not work as expected. Defaulting to "openssl-1.1.x".
Please manually install OpenSSL via `apt-get update -y && apt-get install -y openssl` and try installing Prisma again. If you're running Prisma on Docker, add this command to your Dockerfile, or switch to an image that already has OpenSSL installed.

As an obvious next step I've added OpenSSL to the Docker image in my fork and hit a new error:

PrismaClientInitializationError: Prisma Client could not locate the Query Engine for runtime "linux-arm64-openssl-3.0.x".
This happened because Prisma Client was generated for "linux-arm64-openssl-1.1.x", but the actual deployment required "linux-arm64-openssl-3.0.x".
Add "linux-arm64-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", "debian-openssl-3.0.x", "linux-arm64-openssl-3.0.x"]
}
The following locations have been searched:
  /opt/lavamusic/node_modules/.prisma/client
  /opt/lavamusic/node_modules/@prisma/client
  /tmp/prisma-engines
  /opt/lavamusic/prisma
    at wa (/opt/lavamusic/node_modules/@prisma/client/runtime/library.js:64:805)
    at async Object.loadLibrary (/opt/lavamusic/node_modules/@prisma/client/runtime/library.js:111:10060)
    at async wt.loadEngine (/opt/lavamusic/node_modules/@prisma/client/runtime/library.js:112:448)
    at async wt.instantiateLibrary (/opt/lavamusic/node_modules/@prisma/client/runtime/library.js:111:12778) {
  clientVersion: '5.13.0',
  errorCode: undefined
}

I followed the recommendation and added the target, just to hit another issue:

[5/4/2024] [7:01:08 PM] [antiCrash.js] [Lavamusic] › ✖  error     Unhandled Rejection at: Promise {
  <rejected> PrismaClientKnownRequestError: 
  Invalid `prisma.stay.findMany()` invocation:
  
  
  The table `main.Stay` does not exist in the current database.
      at In.handleRequestError (/opt/lavamusic/node_modules/@prisma/client/runtime/library.js:122:6854)
      at In.handleAndLogRequestError (/opt/lavamusic/node_modules/@prisma/client/runtime/library.js:122:6188)
      at In.request (/opt/lavamusic/node_modules/@prisma/client/runtime/library.js:122:5896)
      at async l (/opt/lavamusic/node_modules/@prisma/client/runtime/library.js:127:11167)
      at async ServerData.get_247 (file:///opt/lavamusic/dist/database/server.js:84:20)
      at async NodeConnect.run (file:///opt/lavamusic/dist/events/player/NodeConnect.js:11:20) {
    code: 'P2021',
    clientVersion: '5.13.0',
    meta: { modelName: 'Stay', table: 'main.Stay' }
  }
} reason: PrismaClientKnownRequestError: 
Invalid `prisma.stay.findMany()` invocation:

When trying to evoke a slash command, it will throw the same error but for the main.Setup table. This seems to be a migration issue, but my Prisma knowledge isn't deep enough to understand what went wrong here. You can check the image build log here: https://github.com/alexandreteles/lavamusic/actions/runs/8952292488/job/24589527694 and you'll see that all the Prisma steps seem to work properly. I wanted to make a PR for this, but now I am unsure of what would be my next step. Is there more information I can provide to help with debug and/or finish a fix and PR?

@syleront
Copy link

syleront commented May 6, 2024

Not an arm64 only, x86 here and faced with this problem too.

@PoulpY2K
Copy link

PoulpY2K commented May 17, 2024

Hello, I've stumbled upon the same error. Seems like the database is out of sync with the model, which throws the table main.Stay does not exist in the current database error.

As a temporary fix, you can execute the following command to sync the DB with the prisma model :
npx prisma db push

This would not happen if we had migrations to apply, but they are not present in the prisma folder. My guess is that Lavamusic has multiple db providers and you have to choose what fits you best.

Although, it should probably appear in the README file.

EDIT: You actually have a step by step guide for prisma in the README, if you actually do the initial migration you will also get in sync with your model.

@LemonJoey
Copy link

In the Dockerfile openssl is being installed into the build image and not the production image. To fix this add
RUN apt-get update -qq && \
apt-get install -y openssl
after Stage 2 not before. You can insert it just after
# Stage 2: Create production image
FROM node:20-slim
ENV NODE_ENV production
WORKDIR /opt/lavamusic/
INSERT HERE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants