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 Library Not Found

See original GitHub issue

Bug description

We have recently been seeing query engine library errors on our app hosted on vercel. This has been happening for about a day and suddenly started happening intermittently. This is really weird because it says it wants “rhel-openssl-1.1.x” and that we incorrectly pinned to “rhel-openssl-1.1.x”. We have tried to explicitely add binaryTargets = ["native", "rhel-openssl-1.0.x", "rhel-openssl-1.1.x"], but this causes our build to fail with function size errors. I would appreciate any pointers here.

Query engine library for current platform "rhel-openssl-1.1.x" could not be found.
You incorrectly pinned it to rhel-openssl-1.1.x

This probably happens, because you built Prisma Client on a different platform.
(Prisma Client looked in "/var/task/node_modules/@prisma/client/ultron/runtime/libquery_engine-rhel-openssl-1.1.x.so.node")

Searched Locations:

  /var/task/node_modules/@prisma/.prisma/client
  /vercel/path0/node_modules/@prisma/client/ultron
  /var/task/node_modules/@prisma/client/ultron
  /var/task/node_modules/@prisma/client/ultron
  /var/task/node_modules/@prisma/client/ultron
  /tmp/prisma-engines
  /var/task/node_modules/@prisma/client/ultron


To solve this problem, add the platform "rhel-openssl-1.1.x" to the "binaryTargets" attribute in the "generator" block in the "schema.prisma" file:
generator client {
  provider      = "prisma-client-js"
  binaryTargets = ["native"]
}

Then run "prisma generate" for your changes to take effect.
Read more about deploying Prisma Client: https://pris.ly/d/client-generator

I see a related issue here: #13266

How to reproduce

It currently seems to cause random requests to error out. I am not able to identify a pattern here.

Expected behavior

I expect the right query engine library to be used.

Prisma information

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

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["filterJson", "dataProxy"]
  output          = "../../../../node_modules/@prisma/client/ultron"
}

generator dbml {
  provider = "prisma-dbml-generator"
}

Environment & setup

This is currently happening on vercel’s serverless platform which I believe uses AWS.

Prisma Version

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

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:4
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
RoryKellycommented, Oct 2, 2022

I think the cause of this issue is that Prisma is not searching the correct directory for the binary.

in my case I am compiling for AWS lambda, I get the error:

Query engine library for current platform \rhel-openssl-1.0.x\ could not be found.
You incorrectly pinned it to rhel-openssl-1.0.x

This probably happens because you built Prisma Client on a different platform.
(Prisma Client looked in \/var/task/src/libquery_engine-rhel-openssl-1.0.x.so.node\)

Searched Locations:

  /.prisma/client
  /home/runner/work/8bars/8bars/backend-v2/node_modules/@prisma/client
  /var/task
  /var/task/src
  /var/task/src
  /tmp/prisma-engines
  /var/task/src

You already added the platforms \debian-openssl-1.1.x\ \rhel-openssl-1.0.x\ to the \generator\ block
in the \schema.prisma\ file as described in https://pris.ly/d/client-generator
but something went wrong. That's suboptimal.

looking at the search paths it is missing

  /home/runner/work/8bars/8bars/backend-v2/node_modules/.prisma/client

The binaries are located here and not in the @prisma/client directory

1reaction
jschuurcommented, Aug 9, 2022

I’ve tried @VictorArowo’s approach, but still running into issues. Bizarrely, the error is pretty contradictory:

Query engine library for current platform "darwin-arm64" could not be found.
You incorrectly pinned it to darwin-arm64

In my particular implementation, I’m using this in a Yarn workspaces monorepo (test repo) with serverless-webpack-prisma. The same monorepo also reuses this Prisma client from a shared package in a Next.js site workspace, and Prisma works fine there, making me think my problem might actually be more specific to serverless-webpack-prisma (I’ve also asked there in this issue.

More detailed error message:

❮ sls invoke local -f videos -s local                                                                                              09:02 Lise
DOTENV: Could not find .env file.

asset src/videos.js 1.19 MiB [emitted] (name: src/videos)
  asset src/schema.prisma 4.61 KiB [emitted] [from: ../../packages/prisma/prisma/schema.prisma] [copied]
  cacheable modules 1.13 MiB
    modules by path ../../node_modules/@prisma/client/ 1.1 MiB
      ../../node_modules/@prisma/client/index.js 59 bytes [built] [code generated]
      ../../node_modules/@prisma/client/runtime/index.js 1.1 MiB [built] [code generated]
    ./src/videos.js 372 bytes [built] [code generated]
    ../../node_modules/.prisma/client/index.js 29.2 KiB [built] [code generated]
  + 21 modules
  webpack 5.74.0 compiled successfully in 375 ms

PrismaClientInitializationError: 
Invalid `prisma.video.findMany()` invocation:


  Query engine library for current platform "darwin-arm64" could not be found.
You incorrectly pinned it to darwin-arm64

This probably happens, because you built Prisma Client on a different platform.
(Prisma Client looked in "/Users/joostschuur/Code/Personal/_Tests/yarn-workspaces-prisma-nextjs-serverless/services/backend/.webpack/service/src/libquery_engine-darwin-arm64.dylib.node")

Searched Locations:

  /Users/joostschuur/Code/Personal/_Tests/yarn-workspaces-prisma-nextjs-serverless/services/backend/.prisma/client
  /Users/joostschuur/Code/Personal/_Tests/yarn-workspaces-prisma-nextjs-serverless/node_modules/@prisma/client
  /Users/joostschuur/Code/Personal/_Tests/yarn-workspaces-prisma-nextjs-serverless/services/backend/.webpack/service
  /Users/joostschuur/Code/Personal/_Tests/yarn-workspaces-prisma-nextjs-serverless/services/backend/.webpack/service/src
  /Users/joostschuur/Code/Personal/_Tests/yarn-workspaces-prisma-nextjs-serverless/services/backend/.webpack/service/src
  /tmp/prisma-engines
  /Users/joostschuur/Code/Personal/_Tests/yarn-workspaces-prisma-nextjs-serverless/services/backend/.webpack/service/src

You already added the platform "darwin-arm64" to the "generator" block
in the "schema.prisma" file as described in https://pris.ly/d/client-generator,
but something went wrong. That's suboptimal.

Please create an issue at https://github.com/prisma/prisma/issues/new
    at RequestHandler.handleRequestError (webpack://backend/../../node_modules/@prisma/client/runtime/index.js?:28655:13)
    at PrismaClient._getDmmf (webpack://backend/../../node_modules/@prisma/client/runtime/index.js?:29727:23)
    at async PrismaClient._executeRequest (webpack://backend/../../node_modules/@prisma/client/runtime/index.js?:29648:22)
    at async consumer (webpack://backend/../../node_modules/@prisma/client/runtime/index.js?:29607:18)
    at async PrismaClient._request (webpack://backend/../../node_modules/@prisma/client/runtime/index.js?:29626:16)
    at async module.exports.handler (webpack://backend/./src/videos.js?:8:18) {
  clientVersion: '4.1.1',
  errorCode: undefined
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Prisma query engine not found on mac M1 - Stack Overflow
I can't seem to figure out how to generate the right query engine binary with darwin and not darwin-arm64 , or have the...
Read more >
Query engine (Concepts) - Prisma
Prisma's query engine manages the communication with the database when using Prisma Client. Learn how it works on this page.
Read more >
@prisma/engines - npm
The postinstall hook of this package downloads all Prisma engines available for the current platform, namely the Query Engine, ...
Read more >
Athena error catalog - AWS Documentation
ErrorCategory specifies whether the cause of the failed query is due to ... 200, Query engine had an internal error ... 1307, Selected...
Read more >
GraphQL Code Libraries, Tools and Services
Removing Queries, Mutations, Fields/InputFields or Arguments that refer to Type that does not exist in - or has been removed from - your...
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