question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Get config: Unable to establish a connection to query-engine-node-api library

See original GitHub issue

Bug description

Hi,

I’m having an issue that has already been described in other (closed) issues, but there isn’t a solution anywhere for it. Issue #13717 focuses on node being installed via snap, but this isn’t the case, as you can see here:

$ whereis node
node: /home/mael/.local/share/fnm/node-versions/v18.9.1/installation/bin/node
$ whereis openssl
openssl: /usr/bin/openssl /home/linuxbrew/.linuxbrew/bin/openssl /usr/share/man/man1/openssl.1ssl.gz

Indeed, node isn’t installed through snap but through fnm, an dI have tested various means of installing it (nvm for instance) to no avail.

This comment has the same issue as me, but sadly didn’t get an answer either.

So, here is my output trying to run prisma generate (it is in the pnpm prepare script, so automatically run by pnpm install):

 ~/Documents/Projects/roboct0 > pnpm i          
  corepack Reusing pnpm@7.12.1 +0ms
Scope: all 2 workspace projects
Lockfile is up to date, resolution step is skipped
Already up to date
packages/api prepare$ prisma generate
│ 2022-09-24T14:15:16.813Z prisma:engines  binaries to download libquery-engine, migration-engine, introspection-engine, prisma-fmt
│ 2022-09-24T14:15:17.144Z prisma:loadEnv  project root found at /home/mael/Documents/Projects/roboct0/packages/api/package.json
│ 2022-09-24T14:15:17.158Z prisma:tryLoadEnv  Environment variables loaded from /home/mael/Documents/Projects/roboct0/packages/api/.env
│ Environment variables loaded from .env
│ Prisma schema loaded from prisma/schema.prisma
│ 2022-09-24T14:15:17.361Z prisma:getConfig  Using CLI Query Engine (Node-API Library) at: /home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/libquery_engi
│ 2022-09-24T14:15:17.362Z prisma:getConfig  error of type "connection-error" in getConfigNodeAPI:
│  {
│   reason: 'Unable to establish a connection to query-engine-node-api library. It seems there is a problem with your OpenSSL installation!',
│   error: Error: Unable to require(`/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/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
│       at load (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:89300:11)
│       at error2 (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:89366:13)
│       at tryCatch (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:88832:19)
│       at loadNodeAPILibrary (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:89365:5)
│       at getConfigNodeAPI (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:89464:5)
│       at async getConfig (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:89445:16)
│       at async getGenerators (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:91517:18)
│       at async _Generate.parse (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:96766:20)
│       at async main (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:98499:18)
│ }
│ Error: 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(`/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/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
│ [Context: getConfig]
│ Prisma CLI Version : 4.3.1
│     at /home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:89533:12
│     at O.run (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:86444:12)
│     at O.otherwise (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:86421:115)
│     at getConfigNodeAPI (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:89531:6)
│     at async getConfig (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:89445:16)
│     at async getGenerators (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:91517:18)
│     at async _Generate.parse (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:96766:20)
│     at async main (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:98499:18)
└─ Failed in 868ms
 ELIFECYCLE  Command failed with exit code 1.

I don’t know what to do, I only just switched from Windows where everything was working just fine to Ubuntu and I can’t seem to be able to use Prisma at all now. Of course, I didn’t copy and paste anything, I used git clone to get my project in order to work on it on my newly installed Linux distro.

How to reproduce

  1. Do a fresh install of Ubuntu 22.04.1
  2. Create a project using Prisma
  3. Try to generate a schema

Expected behavior

I expected it to generate the prisma client without a hitch, as it always had up until that point.

Prisma information

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["fullTextSearch"]
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();

Environment & setup

  • OS: Ubuntu 22.04.1 LTS
  • Database: PostgreSQL
  • Node.js version: v18.9.1

Prisma Version

Error: Unable to require(`/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/@prisma+engines@4.3.1/node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node`)
 libssl.so.1.1: cannot open shared object file: No such file or directory
    at load (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:89300:11)
    at getEngineVersion (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:90023:16)
Error: Command failed with exit code 127: /home/mael/Documents/Projects/roboct0/node_modules/.pnpm/@prisma+engines@4.3.1/node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x --version
/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/@prisma+engines@4.3.1/node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
    at makeError (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:3641:18)
    at handlePromise (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:4409:33)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async getEngineVersion (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:90026:20) {
  shortMessage: 'Command failed with exit code 127: /home/mael/Documents/Projects/roboct0/node_modules/.pnpm/@prisma+engines@4.3.1/node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x --version',
  command: '/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/@prisma+engines@4.3.1/node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x --version',
  escapedCommand: '"/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/@prisma+engines@4.3.1/node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x" --version',
  exitCode: 127,
  signal: undefined,
  signalDescription: undefined,
  stdout: '',
  stderr: '/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/@prisma+engines@4.3.1/node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}
Error: Command failed with exit code 127: /home/mael/Documents/Projects/roboct0/node_modules/.pnpm/@prisma+engines@4.3.1/node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x --version
/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/@prisma+engines@4.3.1/node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
    at makeError (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:3641:18)
    at handlePromise (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:4409:33)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async getEngineVersion (/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/prisma@4.3.1/node_modules/prisma/build/index.js:90026:20) {
  shortMessage: 'Command failed with exit code 127: /home/mael/Documents/Projects/roboct0/node_modules/.pnpm/@prisma+engines@4.3.1/node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x --version',
  command: '/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/@prisma+engines@4.3.1/node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x --version',
  escapedCommand: '"/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/@prisma+engines@4.3.1/node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x" --version',
  exitCode: 127,
  signal: undefined,
  signalDescription: undefined,
  stdout: '',
  stderr: '/home/mael/Documents/Projects/roboct0/node_modules/.pnpm/@prisma+engines@4.3.1/node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}
prisma                  : 4.3.1
@prisma/client          : 4.3.1
Current platform        : debian-openssl-1.1.x
Query Engine (Node-API) : E_CANNOT_RESOLVE_VERSION (at ../../node_modules/.pnpm/@prisma+engines@4.3.1/node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
Migration Engine        : E_CANNOT_RESOLVE_VERSION (at ../../node_modules/.pnpm/@prisma+engines@4.3.1/node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine    : E_CANNOT_RESOLVE_VERSION (at ../../node_modules/.pnpm/@prisma+engines@4.3.1/node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary           : prisma-fmt c875e43600dfe042452e0b868f7a48b817b9640b (at ../../node_modules/.pnpm/@prisma+engines@4.3.1/node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Format Wasm             : @prisma/prisma-fmt-wasm 4.3.0-32.c875e43600dfe042452e0b868f7a48b817b9640b
Default Engines Hash    : c875e43600dfe042452e0b868f7a48b817b9640b
Studio                  : 0.473.0

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jakeklassencommented, Oct 29, 2022

I found this setup useful on Ubuntu 22.04 on WSL 2.

$ mkdir $HOME/opt && cd $HOME/opt
$ wget https://www.openssl.org/source/openssl-1.1.1o.tar.gz
$ tar -zxvf openssl-1.1.1o.tar.gz
$ cd openssl-1.1.1o
$ ./config && make && make test # some tests will fail, it's not an issue
$ mkdir $HOME/opt/lib
$ mv $HOME/opt/openssl-1.1.1o/libcrypto.so.1.1 $HOME/opt/lib/
$ mv $HOME/opt/openssl-1.1.1o/libssl.so.1.1 $HOME/opt/lib/

And then

export LD_LIBRARY_PATH=$HOME/opt/lib:$LD_LIBRARY_PATH

When you need to use it.

1reaction
mael-queaucommented, Sep 26, 2022

Of course, here it is: image

As you can see, the exact same thing happens with npm and a freshly initialized project. I have a done a complete reinstallation of Ubuntu since opening this issue, so I don’t believe that it could be linked to any configuration of conflicting software, for example.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Get config: Unable to establish a connection to query ...
=== Get Config: Unable to establish a connection to query-engine-node-api library. It seems there is a problem with your OpenSSL installation!
Read more >
Error: Get config: Unable to establish a connection to query ...
I run all Prisma command. I start with a fresh supabase database. prisma migrate dev Environment variables loaded from .env Prisma schema loaded ......
Read more >
Query engine (Concepts)
Debugging the query engine. You can access the logs of the query engine by setting the DEBUG environment variable to engine :.
Read more >
PostgreSQL connection errors in release_command
I'm getting a P1017 “Server has closed the connection” error. ... 2022-09-08T13:56:03.862Z prisma:getConfig Using CLI Query Engine (Node-API Library) at: ...
Read more >
please make sure your database server is running at ` ...
From another container which is setup in the same (!!) docker-compose file through "postgresql://postgres:postgres@localhost:5432". If you want to access the ...
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