Unable to establish a connection to query-engine-node-api library using node:16-alpine3.17
See original GitHub issueBug description
When using docker image node:16-alpine3.17 npx prisma generate
encounters the following error in my bitbucket pipeline…
> npx prisma generate
Prisma schema loaded from prisma/schema.prisma
Error: Unable to establish a connection to query-engine-node-api library. It seems there is a problem with your OpenSSL installation!
Details: Unable to require(`/opt/atlassian/pipelines/agent/build/node_modules/prisma/libquery_engine-linux-musl.so.node`)
Error loading shared library libssl.so.1.1: No such file or directory (needed by /opt/atlassian/pipelines/agent/build/node_modules/prisma/libquery_engine-linux-musl.so.node)
[Context: getDmmf]
Prisma CLI Version : 4.7.1
when viewing the build information that bitbucket pipeline provides I see this docker image information.
Images used:
build : docker.io/library/node@sha256:b66869a9dc6bfeed416395c2a2f717bd1779af1cef828fe7941af3a8d0837fdc
I’ve been able to get around the current issue by specifying node:16-alpine3.16
as that was my last working version.
My current hypothesis is that there is an issue using openssl 3.0 because alpine3.17 makes it the default…
OpenSSL 3.0 is now the default OpenSSL version. OpenSSL 1.1 is available via the openssl1.1-compat package.
I believe I’m seeing this now because I previously had node:16-alpine
as my defined docker image in my bitbucket-pipeline.yml, and the tag was changed today to point to alpine3.17
I’m not familiar with the prisma codebase but I did see that there is a parser function that the tests indicate some sort of matching. Perhaps that’s not operating correctly in this case?
Also note that I use linux-musl
in my prisma.schema generator and maybe that’s also part of the problem as well?
Thanks for your input!
How to reproduce
For the problem
- Use a node docker image
node:16-alpine
ornode:16-alpine3.17
- run
npx prisma generate
in the image - See the error output
For a work around
- Use a node docker image
node:16-alpine3.16
- run
npx prisma generate
in the image - See generate successfully
Expected behavior
When using node:16-alpine3.17
docker image and running npx prisma generate
in the image I expect to see a successful client generation like the following…
> npx prisma generate
Prisma schema loaded from prisma/schema.prisma
✔ Generated Prisma Client (4.7.1 | library) to ./node_modules/@prisma/client in 223ms
You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
Prisma information
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl"]
}
datasource db {
provider = "postgresql"
url = env("PRIMARY_DATABASE_URL")
}
model Foo {
\\ model info
}
constructor(configService: ConfigService<Env>) {
this.primary = new PrismaClient();
const replicaUrl =
configService.get(EnvVariables.REPLICA_DATABASE_URL, { infer: true }) ??
'';
this.replica = new PrismaClient({
datasources: { db: { url: replicaUrl } },
});
}
Environment & setup
- OS: alpine3.17
- Database: PostgreSQL
- Node.js version: 16.18.1
Prisma Version
My local version, but the problem is seen in a docker image
npx prisma -v
Environment variables loaded from .env
prisma : 4.7.1
@prisma/client : 4.7.1
Current platform : darwin-arm64
Query Engine (Node-API) : libquery-engine 272861e07ab64f234d3ffc4094e32bd61775599c (at node_modules/@prisma/engines/libquery_engine-darwin-arm64.dylib.node)
Migration Engine : migration-engine-cli 272861e07ab64f234d3ffc4094e32bd61775599c (at node_modules/@prisma/engines/migration-engine-darwin-arm64)
Introspection Engine : introspection-core 272861e07ab64f234d3ffc4094e32bd61775599c (at node_modules/@prisma/engines/introspection-engine-darwin-arm64)
Format Binary : prisma-fmt 272861e07ab64f234d3ffc4094e32bd61775599c (at node_modules/@prisma/engines/prisma-fmt-darwin-arm64)
Format Wasm : @prisma/prisma-fmt-wasm 4.7.1-1.272861e07ab64f234d3ffc4094e32bd61775599c
Default Engines Hash : 272861e07ab64f234d3ffc4094e32bd61775599c
Studio : 0.477.0
Issue Analytics
- State:
- Created 9 months ago
- Comments:5 (2 by maintainers)
The solution with additional context was posted in https://github.com/prisma/prisma/issues/16553#issuecomment-1353302617
Hi @RyanHedges, closing this is a duplicate of #16553. Thanks for the details you’ve reported, we confirm that the Docker image for node:alpine was upgraded from using Alpine:3.16 (which used openssl 1.1) to Alpine:3.17 (which used openssl 3).
We’re working on a solution, for the time being you could install
openssl1.1-compat
when running Prisma on Linux Alpine 3.17+ (apk add openssl1.1-compat
)