Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

Prisma cannot find a query engine for debian-openssl in Docker

ErrorQuery engine library for current platform "debian-openssl-1.1.x" could not be found

Short answer

Prisma Client ships a query engine built for one OS and OpenSSL version. If it was generated for a different target than the one running, or Prisma cannot detect OpenSSL and falls back to 1.1.x, the engine file is missing. List the right target in binaryTargets, then run prisma generate again inside the image.

  • Applies to Prisma ORM 6 with the prisma-client-js generator, Node.js 22, Docker
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Read the platform name in the error. It is what Prisma detected inside the container, and it must match a target that was generated.

    docker run --rm my-image sh -c "cat /etc/os-release; openssl version"
  2. 2Match what you see, then jump to its fix

    1. 1The build or install ran on macOS, Windows or a different image, then node_modules was copied into the containerClient generated on another OS than the one that runs itFix
    2. 2The error names openssl-1.1.x on an image that is newer, and the image is a minimal oneOpenSSL is not installed, so Prisma assumes 1.1.xFix

What does the error look like?

  • Query engine library for current platform "debian-openssl-1.1.x" could not be found

Cause 1 of 2

Client generated on another OS than the one that runs it

1Check

binaryTargets defaults to native, meaning the OS where prisma generate ran. An engine built for macOS is not the one a Debian container needs.

grep -n -A4 "generator client" prisma/schema.prisma

2Fix

Add the target for the OS that runs the app next to native. The Prisma reference lists names such as debian-openssl-3.0.x for Debian 12 and linux-musl-openssl-3.0.x for Alpine 3.17 and newer. Then generate again.

generator client {
  provider      = "prisma-client-js"
  binaryTargets = ["native", "debian-openssl-3.0.x"]
}
// then: npx prisma generate

3Verify

Rebuild the image and start the container.

docker build -t my-image . && docker run --rm my-image

Confirmed by prisma.io

Did this fix it?

Cause 2 of 2

OpenSSL is not installed, so Prisma assumes 1.1.x

1Check

When Prisma cannot find OpenSSL it defaults to 1.1.x. Prisma supports OpenSSL 1.0.x, 1.1.x and 3.x, and the OpenSSL and glibc or musl versions must match the system requirements table.

docker run --rm my-image sh -c "openssl version"

2Fix

Make OpenSSL available in the image, or state the exact target with binaryTargets so Prisma does not guess. Pick the name that matches your base image from the reference table, then regenerate.

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

3Verify

Rebuild the image and start the container.

docker build -t my-image . && docker run --rm my-image

Confirmed by prisma.io

Did this fix it?

How do I stop it coming back?

  • Run prisma generate inside the Docker build, on the same base image that runs the app.
  • Keep the base image and the binaryTargets entry in the same pull request when you change either.
  • Do not copy node_modules from your laptop into an image.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.