prisma/prisma

Unable to require libquery_engine-debian-openssl-3.0.x.so.node

SashaGoncharov19 opened this issue · 2 comments

Bug description

Using Prisma ORM with rage mp server. It's compiling to js file. On windows all works perfect. On ubuntu 22.04 i got:

PrismaClientInitializationError:
Invalid `prisma.service.findMany()` invocation:


Unable to require(`/media/amazon/linux/node_modules/.pnpm/@prisma+client@5.13.0_prisma@5.13.0/node_modules/.prisma/client/libquery_engine-debian-openssl-3.0.x.so.node`).
The Prisma engines do not seem to be compatible with your system. Please refer to the documentation about Prisma's system requirements: https://pris.ly/d/system-requirements

Details: /media/amazon/linux/node_modules/.pnpm/@prisma+client@5.13.0_prisma@5.13.0/node_modules/.prisma/client/libquery_engine-debian-openssl-3.0.x.so.node: undefined symbol: napi_create_promise
    at In.handleRequestError (/media/amazon/linux/packages/server/index.js:31027:19)
    at In.handleAndLogRequestError (/media/amazon/linux/packages/server/index.js:31005:16)
    at In.request (/media/amazon/linux/packages/server/index.js:30996:16)
    at l (/media/amazon/linux/packages/server/index.js:31396:21)
    at loadServices (/media/amazon/linux/packages/server/index.js:95560:20)
    at App.init (/media/amazon/linux/packages/server/index.js:98668:7) {
  clientVersion: '5.13.0',
  errorCode: undefined
}

How to reproduce

Install ubuntu 22.04 jammy.
Install all system requirements as on documentation required.
Build simple typescript project.
Try to run and see error.

Expected behavior

Prisma works as on Windows, bcs on windows it's works perfect with ragemp server.

Prisma information

generator client {
  provider = "prisma-client-js"
  binaryTargets = ["debian-openssl-3.0.x"]
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

generator json {
  provider = "prisma-json-types-generator"
}
import { PrismaClient } from '@prisma/client'

export const prisma = new PrismaClient()

const services = await prisma.service.findMany()

    services.map((serviceLocal, index) => {
        const service = items[serviceLocal.name]
        service.load(
            serviceLocal.position as PositionEx & { radius?: number },
            index,
        )
    })

    logger.success(`Services loaded: ${Object.keys(items).length}`)

Environment & setup

  • OS: Ubuntu 22.04 jammy
  • Database: PostgreSQL
  • Node.js version: v18.20.2
root@amazon-project:/media/amazon# gcc --version
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
root@amazon-project:/media/amazon# openssl version
OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)
root@amazon-project:/media/amazon# sudo apt install zlib1g
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
zlib1g is already the newest version (1:1.2.11.dfsg-2ubuntu9.2).
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

Prisma Version

Environment variables loaded from .env
prisma                  : 5.13.0
@prisma/client          : 5.13.0
Computed binaryTarget   : debian-openssl-3.0.x
Operating System        : linux
Architecture            : x64
Node.js                 : v18.20.2
Query Engine (Node-API) : libquery-engine b9a39a7ee606c28e3455d0fd60e78c3ba82b1a2b (at node_modules/.pnpm/@prisma+engines@5.13.0/node_modules/@prisma/engines/libquery_engine-debian-openssl-3.0.x.so.node)
Schema Engine           : schema-engine-cli b9a39a7ee606c28e3455d0fd60e78c3ba82b1a2b (at node_modules/.pnpm/@prisma+engines@5.13.0/node_modules/@prisma/engines/schema-engine-debian-openssl-3.0.x)
Schema Wasm             : @prisma/prisma-schema-wasm 5.13.0-23.b9a39a7ee606c28e3455d0fd60e78c3ba82b1a2b
Default Engines Hash    : b9a39a7ee606c28e3455d0fd60e78c3ba82b1a2b
Studio                  : 0.500.0

If i will run npx prisma migrate dev/deploy command will be success.

Node.js was installed via NVM.

Hi @SashaGoncharov19, could it be that you have several Node.js versions installed in your system, some of which have a different embedded openssl version than the one installed globally in your system?

I see this as the root of the error, from an executable we build via https://github.com/napi-rs/napi-rs:

libquery_engine-debian-openssl-3.0.x.so.node: undefined symbol: napi_create_promise

Please run the following commands and report back with the answers, hopefully we'll understand why this problem is arising:

  • What's the output of node -e "console.log(process.versions.openssl)"?
  • What's the output of ldd /media/amazon/linux/node_modules/.pnpm/@prisma+client@5.13.0_prisma@5.13.0/node_modules/.prisma/client/libquery_engine-debian-openssl-3.0.x.so.node?
  • What does which node say?
  • What about (cd YOUR_PRISMA_PROJECT && which node)?