lavamusic icon indicating copy to clipboard operation
lavamusic copied to clipboard

[BUG] arm64 docker image appears to be broken

Open alexandreteles opened this issue 2 months ago • 1 comments

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?

alexandreteles avatar May 04 '24 19:05 alexandreteles