prisma: Unable to establish a connection to query-engine-node-api library. It seems there is a problem with your OpenSSL installation!

Bug description

Error: Get Config: 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(`/home/florian/zac-management/node_modules/.pnpm/prisma@4.0.0/node_modules/prisma/libquery_engine-debian-openssl-1.1.x.so.node`)
 libssl.so.1.1: cannot open shared object file: No such file or directory

How to reproduce

  1. run next dev and prisma generate will cause the issue

Environment & setup

  • OS: Ubuntu (WSL2)
  • Database: MySQL (Planetscale)
  • Node.js version: 16.15

Prisma Version

4.0.0

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 16
  • Comments: 38 (8 by maintainers)

Commits related to this issue

Most upvoted comments

For @victorkurauchi and others getting this issue on Alpine Linux (especially in Docker), this comment in another issue pointed out that the latest Alpine strips out legacy OpenSSL APIs. This caused this issue to start occurring for me recently. I was able to fix it without downgrading or cross-grading to bullseye or buster by adding this line to my dockerfile before the npm install command:

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

If any of you still having this issue are using Homebrew on your machine, I found out through some very annoying debugging that apparently Homebrew had a higher precedence on my $PATH, and since I had installed other programs with it that depended on the OpenSSL 1.1 binary, my system was defaulting to that as the binary to use for OpenSSL instead of the default installed binary by Ubuntu (in my case Pop OS, a derivative of Ubuntu) in /usr/bin/openssl. Try running openssl version and if you get back OpenSSL 1.1.1p 21 Jun 2022 or something with 1.x in it, that may be your issue. By making sure that /usr/bin had precedence in my $PATH over my Homebrew install, my system used the proper binaries installed by apt (openssl, libssl-dev, and libc6). Very niche issue, but hope this might help save someone else 1+ hours of digging 😅. All of this was total user error as the way I had added Homebrew to my $PATH was not what I intended, so I mistakenly had given it higher precedence over all my default /usr system folders.

TLDR check and see if you have any other versions of OpenSSL installed on your system as a peer-dependency via something like Homebrew or another package manager, and make sure that version of OpenSSL is on version 3 or is not taking precedence over your system package manager’s version of OpenSSL

I had the same issue when running my nodejs+prisma app with Docker.

I was initially using FROM node:16-alpine and after changing to FROM node:16-bullseye-slim it was working again.

I switched from FROM node:16-alpine to FROM node:16-alpine3.16 and it works for me. It’s not a “fix”, but it will work for me now.

For node v18 the docker tag node:18.12-alpine3.16 also “fixes” the issue.

I had the same issue when running my nodejs+prisma app with Docker.

I was initially using FROM node:16-alpine and after changing to FROM node:16-bullseye-slim it was working again.

Just curious, does anyone know what changed that could have caused this to be come an issue? Our docker image was using a pinned version (ie: 16.x.x-alpine) and it started having this issue sometime within the past few days.

edit: alpine pushed a new version out that bumped openssl up to 3.0, and the alpine version isn’t pinned in that package name.

Hey everyone, Alberto from Prisma here. For anyone getting this error on Linux Alpine (e.g., on node:alpine or node:lts-alpine), please refer to https://github.com/prisma/prisma/issues/16553#issuecomment-1353302617

Looks like something is happening with the library: openssl1.1-compat it is now switched to “dev” status: https://pkgs.alpinelinux.org/contents?file=libssl.so&path=&name=&branch=&arch=

Probably switching between images is an intermediate solution…

Adding line below helped to build the image:

RUN apk add --no-cache libc6-compat
RUN apk add --no-cache openssl1.1-compat-dev

Here is the full docker file:

## Docker file from here: https://github.com/prisma/prisma/issues/12417#issuecomment-1238242374

##########
## DEPS ##
##########
FROM node:lts-alpine AS deps
RUN apk add --no-cache libc6-compat
RUN apk add --no-cache openssl1.1-compat-dev

WORKDIR /app

# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN \
    if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
    elif [ -f package-lock.json ]; then npm ci; \
    elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i; \
    else echo "Lockfile not found." && exit 1; \
    fi

COPY prisma ./prisma
RUN pnpm prisma generate

#############
## BUILDER ##
#############
FROM node:lts-alpine  AS builder
RUN apk add --no-cache libc6-compat

WORKDIR /app

COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app .
COPY . .

RUN npm run build

############
## RUNNER ##
############
FROM node:lts-alpine  AS runner

WORKDIR /app

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./
USER nextjs

CMD ["node", "./main.js"]

I switched from FROM node:16-alpine to FROM node:16-alpine3.16 and it works for me. It’s not a “fix”, but it will work for me now.

If you have conda running on base, just go ahead and deactivate it conda deactivate then run npx prisma studio

Now I get it. Well I found out that openssl was the one for anaconda using the command which openssl which returned the path of the anaconda version. With that I opened the .zshrc (nano .zshrc) and commented out everything I had of anaconda reference. To confirm I used the command which openssl again and now it pointed to the path of the most current version

Same type of error

Error: Get Config: 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(`/home/max/WWW-PROJECT/vendeurv3/node_modules/@prisma/engines/libquery_engine-debian-openssl-3.0.x.so.node`)
 /snap/core20/current/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /lib/x86_64-linux-gnu/libcrypto.so.3)

Prisma CLI Version : 4.0.0 Ubuntu 22.04 LTS NodeJS 16.15.1 Database: MySQL (Planetscale)

I installed OpenSSL.Light and the problem is gone. Env: Node 16 LTS, Windows 11.

Even with OpenSSL installed on my machine (I have installed it through Brew), that’s what solved for me (Ubuntu 22.04): https://stackoverflow.com/a/72633324/1747282

Guys, I had this problem here and I found out that anaconda (which uses python) had the openssl version in 1.1.0, even though I updated the openssl version for my machine in 3.0.2 zsh just couldn’t find this version the anaconda. What I did was put the version of my machine as the main version of the system, with this change prisma started working again !!

Thank @janpio it was the problem.

NodeJS was sandbox by Ubuntu Software (Snap)

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs

now everything is working