prisma: Failed to detect linux distro + `Error: Unknown binaryTarget debian-openssl-0.0.x and no custom engine files were provided` after upgrading from 4.8.1 to 4.9.0

Bug description

Previously, prisma generate worked well with my manjaro linux distro until after an update from 4.8.1 to 4.9.0. Here’s the error I get when I try to do anything with prisma:

prisma:warn Prisma failed to detect the Linux distro in use, and may not work as expected. Defaulting to "debian".
Error: Unknown binaryTarget debian-openssl-0.0.x and no custom engine files were provided

This error is definitely related to the update, I still have branches without the update that work well.

How to reproduce

After setting up a new prisma 4.9 project and installing the dependencies, run prisma generate in Manjaro linux distro.

Expected behavior

Running prisma generate, should generate the prisma client.

Prisma information

generator client {
  provider = "prisma-client-js"
}

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

model User {
  id     String  @id
  name   String
}

Environment & setup

  • OS: DISTRIB_ID=ManjaroLinux DISTRIB_RELEASE=22.0.0 DISTRIB_CODENAME=Sikaris DISTRIB_DESCRIPTION=“Manjaro Linux”
  • Database: PostgreSQL
  • Node.js version: 16.18.1
  • openssl: OpenSSL 3.0.7 1 Nov 2022 (Library: OpenSSL 3.0.7 1 Nov 2022)

ls /lib | grep ssl gives:

libevent_openssl-2.1.so
libevent_openssl-2.1.so.7
libevent_openssl-2.1.so.7.0.1
libevent_openssl.so
libgnutls-openssl.so
libgnutls-openssl.so.27
libgnutls-openssl.so.27.0.2
libssl3.so
libssl.so
libssl.so.0.9.8
libssl.so.1.1
libssl.so.3
libxmlsec1-openssl.so
libxmlsec1-openssl.so.1
libxmlsec1-openssl.so.1.2.37
openssl-0.9.8
openssl-1.1
ossl-modules

Here’s the os-release note from /etc/os-release

NAME="Manjaro Linux"
PRETTY_NAME="Manjaro Linux"
ID=musl
ID_LIKE=arch
BUILD_ID=rolling
ANSI_COLOR="32;1;24;144;200"
HOME_URL="https://manjaro.org/"
DOCUMENTATION_URL="https://wiki.manjaro.org/"
SUPPORT_URL="https://forum.manjaro.org/"
BUG_REPORT_URL="https://docs.manjaro.org/reporting-bugs/"
PRIVACY_POLICY_URL="https://manjaro.org/privacy-policy/"
LOGO=manjarolinux

Prisma Version

4.9.0

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 3
  • Comments: 18 (6 by maintainers)

Most upvoted comments

This is great. @jkomyno, I can confirm that this now works smoothly. I did try to install different versions of libssl in a bit to workaround this issue, none of which worked. At the point of writing this, all these changes have been reverted.

Here’s the output from running npx prisma@4.8.1 version:

prisma                  : 4.8.1
@prisma/client          : 4.8.1
Current platform        : debian-openssl-3.0.x
Query Engine (Node-API) : libquery-engine d6e67a83f971b175a593ccc12e15c4a757f93ffe (at ../../node_modules/.pnpm/@prisma+engines@4.8.1/node_modules/@prisma/engines/libquery_engine-debian-openssl-3.0.x.so.node)
Migration Engine        : migration-engine-cli d6e67a83f971b175a593ccc12e15c4a757f93ffe (at ../../node_modules/.pnpm/@prisma+engines@4.8.1/node_modules/@prisma/engines/migration-engine-debian-openssl-3.0.x)
Introspection Engine    : introspection-core d6e67a83f971b175a593ccc12e15c4a757f93ffe (at ../../node_modules/.pnpm/@prisma+engines@4.8.1/node_modules/@prisma/engines/introspection-engine-debian-openssl-3.0.x)
Format Binary           : prisma-fmt d6e67a83f971b175a593ccc12e15c4a757f93ffe (at ../../node_modules/.pnpm/@prisma+engines@4.8.1/node_modules/@prisma/engines/prisma-fmt-debian-openssl-3.0.x)
Format Wasm             : @prisma/prisma-fmt-wasm 4.8.0-61.d6e67a83f971b175a593ccc12e15c4a757f93ffe
Default Engines Hash    : d6e67a83f971b175a593ccc12e15c4a757f93ffe
Studio                  : 0.479.0

@jkomyno yes, works, detected as debian-openssl-3.0.x

Hi @n05la3 @fmujakitz, could you please confirm that this solution works for you?

Moreover, could you please paste here the result of npx prisma@4.8.1 version on your Manjaro system?

And, to better understand how we can explicitly add a test for this issue into our ecosystem-tests, do you recall whether you had manually installed a few libssl versions in your system?

I’ve had the same issue with Error: Unknown binaryTarget debian-openssl-0.0.x and no custom engine files were provided, and tracked it down to getPlatform.

The problem is that the parsed libsslVersion=0.0.x on L346 is valid, but binaries for that version apparently do not exist.

libsslVersion should be checked against supportedLibSSLVersions on L17 and returned accordingly, which covers the case of preferring older versions.

Otherwise, it should fall back to openssl version -v, and return the latest.

Temp fix at node_modules/@prisma/engines/dist/index.js

  if (libsslFilename) {
    debug2(`Found libssl.so file using "ldconfig" or other generic paths: ${libsslFilenameFromSpecificPath}`);
    const libsslVersion = parseLibSSLVersion(libsslFilename);
    if (libsslVersion && ['1.0.x', '1.1.x', '3.0.x'].includes(libsslVersion)) {
      return libsslVersion;
    }
  }`

@lcdss @DownloadableFox @Grahf0085 @Please comment over on #17545

In this issue we will only track the debian-openssl-0.0.x related problem moving forward. Thanks.

I’ve created this issue to track the unrelated warnings on Arch: https://github.com/prisma/prisma/issues/17545