prisma: `__res_init: symbol not found` when running Prisma

What error exactly @cmwhited? Can you try with a prisma@dev and @prisma/client@dev (or version 4.0.0 which will be release tomorrow) please and post the full output you are getting? That would help us to make sure you ar egetting the same error indeed.

Updated to v4.0.0 and it still fails. I think it is actually an issue with pnpm. Testing now

update

after upgrading to v4, it is now throwing this more verbose error

#21 2.546 Error: Get Config: Unable to establish a connection to query-engine-node-api library. It seems there is a problem with your OpenSSL installation!
#21 2.546 Details: Unable to require(`/app/node_modules/.pnpm/prisma@4.0.0/node_modules/prisma/libquery_engine-linux-arm64-openssl-1.1.x.so.node`)
#21 2.546  Error relocating /app/node_modules/.pnpm/prisma@4.0.0/node_modules/prisma/libquery_engine-linux-arm64-openssl-1.1.x.so.node: __res_init: symbol not found

update 2

Switching from pnpm to yarn does not solve the issue, throws error

#18 1.179 api:gen:types: Prisma schema loaded from prisma/schema.prisma
#18 1.419 api:gen:types: Error: Get Config: Unable to establish a connection to query-engine-node-api library. It seems there is a problem with your OpenSSL installation!
#18 1.421 api:gen:types: Details: Unable to require(`/app/node_modules/prisma/libquery_engine-linux-arm64-openssl-1.1.x.so.node`)
#18 1.421 api:gen:types:  Error relocating /app/node_modules/prisma/libquery_engine-linux-arm64-openssl-1.1.x.so.node: __res_init: symbol not found
#18 1.421 api:gen:types: 
#18 1.421 api:gen:types: Prisma CLI Version : 4.0.0
#18 1.438 api:gen:types: error Command failed with exit code 1.

idk if it helps, but here are my versions

  • nodejs: v16.15.0
  • yarn: v1.22.17
  • pnpm: v7.3.0
  • mac osx: v12.4, m1 chip
  • docker: version 20.10.16, build aa7e414

_Originally posted by @cmwhited in https://github.com/prisma/prisma/issues/13717#issuecomment-1169255951_

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 7
  • Comments: 27 (5 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks @edlundin - that unblocked me. Adding RUN apk add --update --no-cache openssl1.1-compat to my dockerfile has fixed builds without needing to resort to the downgrade/crossgrade/emulation solutions on other threads.

I had the same issue with the docker image node:19-alpine, but using node:19-alpine3.16 fixed it.

Could it be an issue with alpine 3.17? Quoting https://alpinelinux.org/posts/Alpine-3.17.0-released.html, the default OpenSSL version, starting from 3.17, is 3.0. To use OpenSSL 1.1, installing the package openssl1.1-compat seems necessary.

@senorscan Interesting, it works for me for 16.12-alpine, but for 18 it won’t work. It seems there really is some regression. Maybe you can try 16.12.

@janpio switching docker to the 16.15-slim image does work. So it is an xx-alpine docker image issue

Yeah somebody should definitely put up somewhere that installing Prisma on alpine crashes with these most bizarre error messages. Switching to slim and adding RUN apt-get update && apt-get -y install openssl fixed this for me.

Hey, Alberto from Prisma here.

For people facing this issue on Linux Alpine (e.g., when using the node:alpine, node:lts-alpine Docker images), please refer to this solution: https://github.com/prisma/prisma/issues/16553#issuecomment-1353302617

@janpio switching docker to the 16.15-slim image does work. So it is an xx-alpine docker image issue

weird, it was working fine for months, and just from this morning it has been failing in my Gitlab CI, building manually from local is fine. No change from my Dockerfile at all.

Adding this before npm install fixed the issue:

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

Update: build success with the above change, but at runtime , it throw error:

  | Unable to load Node-API Library from /app/node_modules/.prisma/client/libquery_engine-linux-musl.so.node, Library may be corrupt
  |     at RequestHandler.handleRequestError (/app/node_modules/@prisma/client/runtime/index.js:30879:13)
  |     at /app/node_modules/@prisma/client/runtime/index.js:31300:25
  |     at processTicksAndRejections (node:internal/process/task_queues:96:5)
  |     at async PrismaClient._executeRequest (/app/node_modules/@prisma/client/runtime/index.js:31864:22) {
  |   clientVersion: '4.5.0',
  |   errorCode: undefined
  | }

I specified the node version as “node:alpine” in my Dockerfile. I switched it to 16.2 and now it works fine.

@valentinpezon-primo In my case I’m on node:fermium-alpine still but yes to the rest. Just needed to be sure to add the apk command before the npm install command because of the prisma post-install hook.

getting this issue in my bitbucket pipelines too

@valentinpezon-primo yes, I just tried it with node:18.12-alpine, it seems to work for any version. Perfect, thanks.

Same issue on my side using prisma 4.x.x, any update?

I’m using node:18-alpine, upgraded from prisma 3.14 to 4.3.1 and now I experience the same issue…

PS: I’m not running this via compose - but deploy image to AWS ECS (fargate) and it doesn’t want to work there

fixed as well by switching to FROM node:16.2.0-alpine AS deps

weird, it was working fine for months, and just from this morning it has been failing in my Gitlab CI, building manually from local is fine. No change from my Dockerfile at all.

Adding this before npm install fixed the issue:

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

When I Add this line I can build the Docker-file but I get the error:

In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues
Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues

it is related to OpenSSL as @edlundin already said. Prisma only supports 1.X instead of 3.0 which is now default in the alpine builds >3.16

see also this issue https://github.com/prisma/prisma/issues/16553

@senorscan Interesting, it works for me for 16.12-alpine, but for 18 it won’t work. It seems there really is some regression. Maybe you can try 16.12.

It worked! Thank you very much.