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.

Query engine exited with code 127 /app/node_modules/.prisma/client/query-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

See original GitHub issue

Bug description

Hello. I’m getting the following error when I’m trying to use Prisma client in a ts file.

{
    "level": 30,
    "time": 1628723419319,
    "stack": "Error: Query engine exited with code 127 /app/node_modules/.prisma/client/query-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 cb (/app/node_modules/@prisma/client/runtime/index.js:34806:17) at processTicksAndRejections (internal/process/task_queues.js:95:5)",
    "type": "Error",
    "msg": "Query engine exited with code 127 /app/node_modules/.prisma/client/query-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"
}

I saw a similar issue https://github.com/prisma/prisma/issues/4741. But the solution/suggestion mention in this issue is not working for me. Please look into this issue.

How to reproduce

  1. npx prisma generate
  2. Docker container is giving me the above error after the startup.

Docker file contents:

# Define Base
FROM node:14-buster-slim AS base

# Build
FROM base as build
ADD ./prisma /app
ADD ./.env.example /app
WORKDIR /app

RUN apt-get update && apt-get install -y openssl 

RUN yarn install --frozen-lockfile
RUN yarn build
RUN yarn install --frozen-lockfile --prod

# Trim down image
FROM node:14-buster-slim AS release

# Add Tini
ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini

USER node

ENTRYPOINT ["/tini", "--"]

# only copy what we need to run the app
COPY --from=build /app/dist /app/dist
COPY --from=build /app/node_modules /app/node_modules
COPY --from=build /app/package.json /app/package.json
COPY --from=build /app/.env.example /app/.env.example

ENV NODE_ENV=production
ENV BUNDLE_ENV=production

WORKDIR /app

CMD ["node", "-r", "dotenv-azure/config-safe", "dist/index.js"]

Expected behavior

Prisma Client should not give any errors.

Prisma information

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

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

model Content {
  id                                Int                        @id
  title                             String
  url                               String
  thumbnailUrl              String?        @map("thumbnail_url")
  publishedAt                String          @db.VarChar(36) @map("published_at")

  @@map("content")
}

Environment & setup

  • OS: Debian
  • Database: PostgreSQL
  • Node.js version: v14.16.0

Prisma Version

prisma               : 2.28.0
@prisma/client       : 2.28.0
Current platform     : debian-openssl-1.1.x
Query Engine         : query-engine 89facabd0366f63911d089156a7a70125bfbcd27 (at node_modules/@prisma/engines/query-engine-debian-openssl-1.1.x)
Migration Engine     : migration-engine-cli 89facabd0366f63911d089156a7a70125bfbcd27 (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine : introspection-core 89facabd0366f63911d089156a7a70125bfbcd27 (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary        : prisma-fmt 89facabd0366f63911d089156a7a70125bfbcd27 (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Default Engines Hash : 89facabd0366f63911d089156a7a70125bfbcd27
Studio               : 0.417.0

Issue Analytics

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

github_iconTop GitHub Comments

4reactions
provHarshaKommanaboyinacommented, Aug 14, 2021

In my original docker file (available in the description of this issue), I have used a base image for trimming down my image as follows. This image needs to have openssl as a dependency.

# Trim down image
FROM node:14-buster-slim AS release

The following docker file solves my issue.

# Define Base
FROM node:14-buster-slim AS base

# install dependency (openssl) for Prisma
FROM base as base-with-dep
RUN apt-get update && apt-get install -y openssl 

# Build
FROM base-with-dep as build
ADD ./prisma /app
ADD ./.env.example /app
WORKDIR /app

RUN yarn install --frozen-lockfile
RUN yarn build
RUN yarn install --frozen-lockfile --prod

# Trim down image
FROM base-with-dep AS release

# Add Tini
ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini

USER node

ENTRYPOINT ["/tini", "--"]

# only copy what we need to run the app
COPY --from=build /app/dist /app/dist
COPY --from=build /app/node_modules /app/node_modules
COPY --from=build /app/package.json /app/package.json
COPY --from=build /app/.env.example /app/.env.example

ENV NODE_ENV=production
ENV BUNDLE_ENV=production

WORKDIR /app

CMD ["node", "-r", "dotenv-azure/config-safe", "dist/index.js"]
1reaction
janpiocommented, Aug 13, 2021

Nice, that is always great if problems go away by itself 😄

Can you let us (and Google) know what needed to be changed? Maybe it can help others in the future that are hitting a similar problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

error while loading shared libraries: libssl.so.1.1: cannot open ...
error while loading shared libraries : libssl.so.1.1: cannot open shared object file: No such file or directory.
Read more >
Ubuntu 22.04 | libssl.so.1.1: cannot open shared object file
This fixes it (a problem with packaging in 22.04):
Read more >
How do I fix error while loading shared libraries Libssl.so.1.1
m.n (where m,n are not both 1). Go to /usr/lib and make a symlink called libssl.so.1.1 to the libssl.so that you have: cd ......
Read more >
imx8: imx-boot do_compile failing while building bsp 5.4
Hi ./mkimage_uboot: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory I think ...
Read more >
error while loading shared libraries: libssl.so.1.1 - Reddit
1.1 : cannot open shared object file: No such file or directory. Hi after upgrading my OS today I got /usr/bin/paru ...
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