Support OpenSSL 3.0 for Alpine Linux

See original GitHub issue

OpenSSL 3.0 is currently the default OpenSSL version in Alpine Linux 3.17 (see CHANGELOG). For Alpine Linux, Prisma only supports OpenSSL 1.X at this time. As a result, the following error is generated:

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(`OMITTED/node_modules/prisma/libquery_engine-linux-musl.so.node`)
 Error loading shared library libssl.so.1.1: No such file or directory (needed by OMITTED/node_modules/prisma/libquery_engine-linux-musl.so.node)
[Context: getDmmf]

Suggested solution

Add OpenSSL 3.0 support to Alpine Linux

Workaround

Install openssl1.1-compat:

apk add openssl1.1-compat

Note that this is only a temporary fix until the Prisma team adds support for OpenSSL 3.0.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Reactions:34
  • Comments:30 (10 by maintainers)

github_iconTop GitHub Comments

55reactions
jkomynocommented, Dec 21, 2022

Update: as of prisma@4.8.0 (released on December 20th 2022), the procedure below is no longer needed, as Prisma now supports OpenSSL 3 on Linux Alpine out of the box.


Hey everyone, Alberto from Prisma here.

Prisma currently needs OpenSSL 1.1.x being installed as a system library on Linux Alpine. For many of you, Prisma suddenly stopped working when run on the node:alpine / node:lts-alpine Docker images. This is because these images are now based on alpine:3.17 (which comes with OpenSSL 3.0.x) rather than alpine:3.16 (which comes with OpenSSL 1.1.x).

You currently have two alternatives:

  • Use a Node.js Docker image based on Alpine 3.16, like node:alpine3.16, node:lts-alpine3.16, node:18.12.1-alpine3.16 (encouraged)

  • Install OpenSSL 1.1.x via the openssl1.1-compat package, e.g., by adding

    RUN apk add --update --no-cache openssl1.1-compat
    

    to your Dockerfile before installing Prisma

We’re also working on a solution on our side to provide native compatibility with OpenSSL 3, which will close this issue altogether. We thank you for your patience.


About the original error listed at the top of this issue:

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(`OMITTED/node_modules/prisma/libquery_engine-linux-musl.so.node`)
 Error loading shared library libssl.so.1.1: No such file or directory (needed by OMITTED/node_modules/prisma/libquery_engine-linux-musl.so.node)
[Context: getDmmf]
  • The error Unable to establish a connection to query-engine-node-api library. It seems there is a problem with your OpenSSL installation! means that Prisma cannot interact with its own engines (which are compiled libraries or binaries compatible), most likely due to Prisma not being able to find OpenSSL on your system.
  • The Error loading shared library libssl.so.1.1 error indeed shows that Prisma cannot find OpenSSL 1.1 in the system, which prevents commands like prisma generate and the Prisma Client from working as expected.

Here is a minimal Dockerfile example based on node:alpine you can use to run Prisma!

# Dockerfile for running Prisma on Linux Alpine 3.17+

# change with the Node.js version of your choice
ARG NODE_VERSION="18.12.1"

# change with the Linux Alpine version of your choice
ARG ALPINE_VERSION="3.17"

FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION} AS base

# install OpenSSL 1.1.x, needed for Linux Alpine 3.17+
RUN apk update \
  && apk add openssl1.1-compat

ENV DATABASE_URL ""
WORKDIR /app

# install your project dependencies
COPY package.json ./
RUN npm i

# copy your project files and Prisma schema
COPY . ./

RUN npx prisma version

Notes:

  • we recommend you to always pin Docker images to a specific version, to ensure reproducible builds
  • we’ve noticed some comments in similar issues suggesting to install libc on Linux Alpine to fix the problem. Please DON’T do this, as it could cause other unexpected errors.
25reactions
aqrlncommented, Dec 20, 2022

Support for OpenSSL 3 in Alpine Linux for x86_64 will be released today (CET) in Prisma 4.8.0. Please let us know if you still run into any issues with 4.8.0!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Alpine Linux 3.17 Released With OpenSSL 3.0, Better Rust ...
The other significant change noted with Alpine Linux 3.17 is Rust programming language support now being available on all architectures.
Read more >
Alpine Linux 3.17 Officially Released with Full ... - 9to5Linux
Alpine Linux 3.17 distribution is now available for download with OpenSSL 3.0 as the default OpenSSL version, GNOME 43, and KDE Plasma 5.26....
Read more >
openssl - Alpine Linux packages
Package, openssl. Version, 3.0.7-r1. Description, Toolkit for Transport Layer Security (TLS). Project, https://www.openssl.org/. License, Apache-2.0.
Read more >
Alpine Linux 3.17 Released With Rust Support, OpenSSL 3.0 ...
Alpine Linux 3.17 comes with OpenSSL 3.0 as the default implementation and Rust support. Learn about what else it supports here.
Read more >
Alpine Linux 3.17 Released: Uses OpenSSL 3.0, Better Rust ...
Alpine Linux 3.17 release is available today and the new version uses OpenSSL 3.0 as the default OpenSSL implementation.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found