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

Prisma generate started throwing that libssl.so.3 is missing (alpine 3.14, node 14) #9624

Closed
mstrujic-cls opened this issue Oct 5, 2021 · 11 comments
Assignees
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/regression A reported bug in functionality that used to work before. team/client Issue for team Client. team/schema Issue for team Schema. topic: binary distribution
Milestone

Comments

@mstrujic-cls
Copy link

Bug description

Prisma generate script started throwing "Error loading shared library libssl.so.3" on Alpine Linux with prisma version 3.2.0. It is working properly with 3.1.1.

How to reproduce

Create a folder with two files:

  • Dockerfile
  • prisma.schema

Dockerfile file

FROM node:lts-alpine3.14

COPY . /usr/src/app/
WORKDIR /usr/src/app

RUN npm i -g prisma@3.2.0

RUN npx prisma generate

prisma.schema file

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "mysql"
  url      = env("DB_CONN")
}

model User { 
  id      Int     @id @default(autoincrement())
}

When you run docker build -t testing . you will get:

#9 [5/5] RUN npx prisma generate
#9 sha256:6220c938a01eaed587102ccb86f0a2b564a558e2be9b7e5884b40cd911cb1d95
#9 2.192 Prisma schema loaded from schema.prisma
#9 2.884 Error: Unable to require(`/usr/src/app/node_modules/prisma/libquery_engine-linux-musl
.so.node`)

#9 2.884  Error loading shared library libssl.so.3: No such file or directory (needed by /usr/
src/app/node_modules/prisma/libquery_engine-linux-musl.so.node)
#9 ERROR: executor failed running [/bin/sh -c npx prisma generate]: exit code: 1

Expected behavior

It should be able to execute prisma generate without error.

Prisma information

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "mysql"
  url      = env("DB_CONN")
}

model User { 
  id      Int     @id @default(autoincrement())
}

Environment & setup

  • OS: Alpine Linux 3.14
  • Database: MySQL
  • Node.js version: v14.18.0

Prisma Version

prisma                  : 3.1.1
@prisma/client          : Not found
Current platform        : linux-musl
Query Engine (Node-API) : libquery-engine c22652b7e418506fab23052d569b85d3aec4883f (
at ../../local/lib/node_modules/prisma/node_modules/@prisma/engines/libquery_engine-linux-musl
.so.node)

Migration Engine        : migration-engine-cli c22652b7e418506fab23052d569b85d3aec48
83f (at ../../local/lib/node_modules/prisma/node_modules/@prisma/engines/migration-engine-linu
x-musl)
Introspection Engine    : introspection-core c22652b7e418506fab23052d569b85d3aec4883
f (at ../../local/lib/node_modules/prisma/node_modules/@prisma/engines/introspection-engine-li
nux-musl)
Format Binary           : prisma-fmt c22652b7e418506fab23052d569b85d3aec4883f (at ..
/../local/lib/node_modules/prisma/node_modules/@prisma/engines/prisma-fmt-linux-musl)
Default Engines Hash    : c22652b7e418506fab23052d569b85d3aec4883f
Studio                  : 0.423.0
@mstrujic-cls mstrujic-cls added the kind/bug A reported bug. label Oct 5, 2021
@armandoborge
Copy link

armandoborge commented Oct 5, 2021

I am having just the same issue, I am running a build pipeline on Google Cloud Run that executes npx prisma migrate deploy in one of the steps, suddenly the build stopped working (with the error you mentioned)

Prisma version:
^2.30.3

Docker Image:
node:14.16.1-alpine3.10

@podviaznikov
Copy link

Same here. All builds stopped working today

@jmannau
Copy link

jmannau commented Oct 6, 2021

As a workaround, you can use node:lts-bullseye-slim or a similar variant. This base image works.

@nasrulfuad
Copy link

I have the same issue, I tried inside the docker container and got this error

Error: Unable to require(`/usr/src/app/node_modules/@prisma/engines/libquery_engine-linux-musl.so.node`)
Error loading shared library libssl.so.3: No such file or directory (needed by /usr/src/app/node_modules/@prisma/engines/libquery_engine-linux-musl.so.node)

Prisma : ^3.1.1
Node image : node:12.19.0-alpine3.9

@armandoborge
Copy link

armandoborge commented Oct 6, 2021

I've also solved the issue by using a different Node image tag on my Dockerfile FROM configuration. I've replaced node:14.16.1-alpine3.10 by node:14.16.1

@richardwardza
Copy link

richardwardza commented Oct 6, 2021

FROM node:14.17.1-alpine with "@prisma/client": "3.1.1" and "prisma": "3.1.1" works

@pantharshit00
Copy link
Contributor

I can confirm this regression. Looks like we might need to adjust our build image in our build pipeline.

@pantharshit00 pantharshit00 added bug/2-confirmed Bug has been reproduced and confirmed. kind/regression A reported bug in functionality that used to work before. topic: binary distribution team/client Issue for team Client. and removed kind/bug A reported bug. labels Oct 6, 2021
@janpio janpio added the 3.2.0 label Oct 6, 2021
@tomhoule tomhoule added the team/schema Issue for team Schema. label Oct 6, 2021
@tomhoule tomhoule added this to the 3.3.0 milestone Oct 6, 2021
@pimeys
Copy link
Contributor

pimeys commented Oct 6, 2021

Retro:

We have all our build images in one repo. For our alpine builds, we've been using node:10-alpine for ages for legacy reasons, and this should follow the latest alpine with a quite old node. When digging into the Dockerfile, it replaces the repository for whatever version with edge, which is the unstable alpine (again for legacy reasons). Now a push to this repo for something totally different triggered a rebuild of the alpine image, which then uses latest edge, which happens to have OpenSSL 3.0 instead of 1.1. This binary of course works only with OpenSSL 3.0...

I now created a new image with rust:alpine, that follows the latest stable and works with the images mentioned in this ticket. We will release a patch release 3.2.1 tomorrow with a rebuild for alpine linux, and we also have an e2e test that should catch regressions such as this in the future.

Thanks for reporting.

@pantharshit00
Copy link
Contributor

pantharshit00 commented Oct 6, 2021

Also, while we are working on fixing this, it looks like binary version of the engine is not affected by this so you can use that as a workaround for now:

generator client {
  provider = "prisma-client-js"
  engineType = "binary"
}

You might also need to set the following environment variables:

PRISMA_CLI_QUERY_ENGINE_TYPE=binary
PRISMA_CLIENT_ENGINE_TYPE=binary

Run prisma generate after you change the engineType.

@Jolg42
Copy link
Member

Jolg42 commented Oct 7, 2021

This is now fixed in the latest version: 3.2.1

@Jolg42 Jolg42 closed this as completed Oct 7, 2021
@mstrujic-cls
Copy link
Author

Thank you! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/regression A reported bug in functionality that used to work before. team/client Issue for team Client. team/schema Issue for team Schema. topic: binary distribution
Projects
None yet
Development

No branches or pull requests