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.

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

See original GitHub issue

Bug description

FROM node:14
WORKDIR /app
COPY package.json ./
COPY tsconfig.json ./
COPY .env ./
COPY src ./src
RUN npm install
RUN npx prisma generate
RUN npx tsc
CMD ["npm", "run", "compare"]

Dockerfile

version: "3.9"
services:
  postgres:
    image: postgres
    environment:
      - POSTGRES_PASSWORD=password
      - POSTGRES_USER=testUser
  mongo:
    image: mongo
  web:
    build: .
    volumes:
      - .:/./app
    depends_on: 
    - postgres
    - mongo

How to reproduce

.

Expected behavior

The dockerfile built image works fine but when I run the same image on the compose I get the following error.

(node:20) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
web_1       | (node:20) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
web_1       | (node:20) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1)
web_1       | (node:20) UnhandledPromiseRejectionWarning: Error: 
web_1       | Invalid `this.prisma.project.createMany()` invocation in
web_1       | /app/dist/Insert/Method1/SQL/InsertTest.js:77:70
web_1       | 
web_1       |    74 return __awaiter(this, void 0, void 0, function () {
web_1       |    75     return __generator(this, function (_a) {
web_1       |    76         switch (_a.label) {
web_1       | →  77             case 0: return [4 /*yield*/, this.prisma.project.createMany(
web_1       |   Query engine library for current platform "debian-openssl-1.1.x" could not be found.
web_1       | You incorrectly pinned it to debian-openssl-1.1.x
web_1       | 
web_1       | This probably happens, because you built Prisma Client on a different platform.
web_1       | (Prisma Client looked in "/app/node_modules/@prisma/client/runtime/libquery_engine-debian-openssl-1.1.x.so.node")
web_1       | 
web_1       | Searched Locations:
web_1       | 
web_1       |   /app/node_modules/.prisma/client
web_1       |   /Users/madhavkhosla/Documents/GitHub/db-comparison/node_modules/@prisma/client
web_1       |   /app/node_modules/@prisma/client
web_1       |   /app/node_modules/.prisma/client
web_1       |   /app/src/models/prisma
web_1       |   /tmp/prisma-engines
web_1       |   /app/node_modules/.prisma/client
web_1       | 
web_1       | 
web_1       | To solve this problem, add the platform "debian-openssl-1.1.x" to the "binaryTargets" attribute in the "generator" block in the "schema.prisma" file:
web_1       | generator client {
web_1       |   provider      = "prisma-client-js"
web_1       |   binaryTargets = ["native"]
web_1       | }
web_1       | 
web_1       | Then run "prisma generate" for your changes to take effect.
web_1       | Read more about deploying Prisma Client: https://pris.ly/d/client-generator
web_1       |     at cb (/app/node_modules/@prisma/client/runtime/index.js:38681:17)
web_1       |     at processTicksAndRejections (internal/process/task_queues.js:95:5)
web_1       | (node:20) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

Prisma information

generator client {
  provider      = "prisma-client-js"
  binaryTargets = ["native", "linux-musl", "debian-openssl-1.1.x", "darwin"]
}

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

Environment & setup

  • OS: MacOS
  • Database: PostgreSQL
  • Node.js version: v14.15.1

Prisma Version

prisma                  : 3.5.0
@prisma/client          : 3.5.0
Current platform        : darwin
Query Engine (Node-API) : libquery-engine 78a5df6def6943431f4c022e1428dbc3e833cf8e (at node_modules/@prisma/engines/libquery_engine-darwin.dylib.node)
Migration Engine        : migration-engine-cli 78a5df6def6943431f4c022e1428dbc3e833cf8e (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine    : introspection-core 78a5df6def6943431f4c022e1428dbc3e833cf8e (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary           : prisma-fmt 78a5df6def6943431f4c022e1428dbc3e833cf8e (at node_modules/@prisma/engines/prisma-fmt-darwin)
Default Engines Hash    : 78a5df6def6943431f4c022e1428dbc3e833cf8e
Studio                  : 0.439.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Jaykobcommented, Nov 10, 2022

Thanks for the info! I spent a couple of hours solving the exact same problem… We’re overwriting node_modules folder with this mount and therefore also the prisma module with the wrong platform dependent stuff inside…

I solved it by keeping the container’s node_module folder with this 2nd volume command:

version: "3.9"
services:
  postgres:
    image: postgres
    environment:
      - POSTGRES_PASSWORD=password
      - POSTGRES_USER=testUser
  mongo:
    image: mongo
  web:
    build: .
    volumes:
      - .:/app
      - /app/node_modules # prevents overwriting
    depends_on: 
    - postgres
    - mongo
1reaction
madhavkhoslaacommented, Dec 16, 2021

Okay, I know why this happened. The reason was that I had the code repo and the docker code folder as volume maps. Even though the prisma was generated on the docker host but because of the docker volume map, prisma was not able to figure out what host it was on.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prisma Query engine library for current platform "debian ...
I have a NodeJS/NestJS project consisting of multiple microservices. I've deployed my postgres database and also a microservice pod which ...
Read more >
Docker Compose release notes | Docker Documentation
Release notes for Docker Compose. ... Fixed compose#10025; Compose does not require service.build.platforms to be ... Bumped OpenSSL from 1.1.1d to 1.1.1f.
Read more >
Prisma engines
Note that this page does not contain any practical information that is ... Prisma Client connects to the query engine in order to...
Read more >
prisma nullable field - You.com | The search engine you control.
query -engine-debian-openssl-1.1.x are fine prisma-client Client Version 2.5.1 prisma-client ... prisma/prisma'DateTime?' does NOT create nullable field#9438.
Read more >
Install Elasticsearch with Docker - Elastic
If you're starting a single-node Elasticsearch cluster in a Docker container, security will be automatically enabled and configured for you. When you start ......
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