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.

Unable to load Node-API Library (libquery_engine-linux-arm64-openssl-1.1.x.so.node), Library may be corrupt

See original GitHub issue

Bug description

Trying to deploy my app on AWS after resolving issue mentioned in issue 15574 I faced with error which says library may be corrupted, It seems no other one have faced the issue, since neither on github prisma issues I found one similar nor on other communities.

Here is the error

Error: Unable to load Node-API Library from /app/libquery_engine-linux-arm64-openssl-1.1.x.so.node, Library may be corrupt

my development platform OS is windows, I am using docker for creating the application image (Alpine Linux)

How to reproduce

  1. Setup nestjs application with prisma
  2. Setup prisma client provider and output file in schema.prisma file
  3. Setup database source in schema.prisma file
  4. Select proper binary target
  5. Set PRISMA_QUERY_ENGINE_LIBRARY env variable pointing location of library engine
  6. Set PRISMA_CLI_BINARY_TARGETS
  7. Generate Prisma client
  8. Create docker image
  9. push and deploy docker image to AWS
  10. And you will get the error

Expected behavior

No response

Prisma information

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

datasource db {
  provider = "mysql"
  url      = env("PRISMA_DB_URL")
}

// ... rest of my models

Environment & setup

Setup Details

  • OS: Amazon Linux 2
  • Database: Aurora MySQL
  • Node.js version: 16.16.0
  • CPE OS Name: cpe:2.3⭕amazon:amazon_linux:2
  • Kernel: Linux 4.14.281-212.5.02.amzn2.aarch64
  • Architecture: arm64
  • Openssl: OpenSSL 1.1.1q 5 Jul 2022
# Environment Variables for deployment on AWS
PRISMA_DB_URL=mysql://username:password@host:port/database
ENV PRISMA_QUERY_ENGINE_LIBRARY=/app/prisma/engines/libquery_engine-linux-arm64-openssl-1.1.x.so.node
ENV PRISMA_CLI_BINARY_TARGETS=linux-arm64-openssl-1.1.x

Prisma Version

# On development PC
prisma                  : 4.3.1
@prisma/client          : 4.3.1
Current platform        : windows
Query Engine (Node-API) : libquery-engine c875e43600dfe042452e0b868f7a48b817b9640b (at node_modules\@prisma\engines\query_engine-windows.dll.node)
Migration Engine        : migration-engine-cli c875e43600dfe042452e0b868f7a48b817b9640b (at node_modules\@prisma\engines\migration-engine-windows.exe)
Introspection Engine    : introspection-core c875e43600dfe042452e0b868f7a48b817b9640b (at node_modules\@prisma\engines\introspection-engine-windows.exe)
Format Binary           : prisma-fmt c875e43600dfe042452e0b868f7a48b817b9640b (at node_modules\@prisma\engines\prisma-fmt-windows.exe)
Format Wasm             : @prisma/prisma-fmt-wasm 4.3.0-32.c875e43600dfe042452e0b868f7a48b817b9640b
Default Engines Hash    : c875e43600dfe042452e0b868f7a48b817b9640b
Studio                  : 0.473.0

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jukbotcommented, Oct 23, 2022

Got the same error too, but the different my app image is based on debian os (node:16-bullseye-slim) which in running stage is (gcr.io/distroless/nodejs:16). When I started the image it’s got this error message

PrismaClientInitializationError: Unable to load Node-API Library from /node_modules/.prisma/client/libquery_engine-debian-openssl-1.1.x.so.node, Library may be corrupt

I’ve tried to set binaryTargets to “debian-openssl-1.1.x” still not worked.

1reaction
tt-mohsencommented, Oct 12, 2022

I am opening new issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues - GitHub
Get Unable to load Node-API Library when using prisma in docker ... -debian-openssl-1.1.x.so.node, Library may be corrupt at RequestHandler.
Read more >
How to Fix "Unable to load Node-API Library" with Cypress on ...
Here's how to fix the "Unable to Load Node-API Library" error that can come up when trying to use Prisma in Cypress tasks...
Read more >
node.js - error states Unable to require(node_modules/prisma ...
It seems there is an issue with the version of OpenSSL installed on your machine. You might need to (re)install OpenSSL.
Read more >
Node.js
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
Read more >
How to Repair your Corrupt Final Cut Pro X Library ... - YouTube
Your browser can't play this video. Learn more. Switch camera ... How to Repair your Corrupt Final Cut Pro X Library Database FCPX...
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