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 for current platform "windows" could not be found

See original GitHub issue

Suddenly, for no apparent reason:

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

    This probably happens, because you built Prisma Client on a different platform.
    (Prisma Client looked in "L:\src\foaf\node_modules\@prisma\client\runtime\query_engine-windows.dll.node")

    Searched Locations:

      L:\src\foaf\node_modules\.prisma\client
      L:\src\foaf\node_modules\@prisma\client
      L:\src\foaf\node_modules\@prisma\client
      L:\src\foaf\node_modules\.prisma\client
      L:\src\foaf\prisma
      /tmp/prisma-engines
      L:\src\foaf\node_modules\.prisma\client

    You already added the platform "windows" 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 Object.getLibQueryEnginePath (node_modules/@prisma/client/runtime/index.js:36461:13)
      at Object.loadEngine (node_modules/@prisma/client/runtime/index.js:36129:33)
      at Object.instantiateLibrary (node_modules/@prisma/client/runtime/index.js:36095:5)

$ grep 'prisma'  package.json
    "prisma": "^3.6.0",

$ node -v
v16.10.0

$ npm -v
7.24.1

Shell is git-bash.

What can I tell you?

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
janpiocommented, Apr 8, 2022

Yeah, we are aware that this is kinda messy and your problem shows exactly how this then can go wrong even when you try to do the right thing. Thanks for the explanation!

2reactions
appuristcommented, Apr 8, 2022

@janpio Okay, the problem seemed to just be that I was using esbuild to produce the output folder and the includes/excludes were copying the linux version only. Our build is eventually for AWS Lambda, built from a Docker image has a different distro, so we specifically build the “rhel-openssl-1.0.x” version for AWS Lambda. But none of that is too relevant here, I just mention it because you asked about multiple targets:

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

This problem was on Windows and our .esbuild didn’t include the .node engine file for Windows, because it was excluded in the serverless.yml file. I added a *.node wildcard instead of the rhel-specific path that was there and it’s fine:

package:
  excludeDevDependencies: false
  patterns:
    - '!node_modules/.prisma/client/libquery_engine-*'
    - '!node_modules/prisma/libquery_engine-*'
    - '!node_modules/@prisma/engines/**'
    - 'node_modules/.prisma/client/schema.prisma'
    - 'node_modules/.prisma/client/*.node'

That last line ensures these are included. We originally had a problem with the size of prisma in the Lambda image so we started filtering down files that weren’t needed at runtime. I don’t think the others are still needed but the last line ensures we have the native engine, whatever that is.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prisma query engine not found on mac M1 - Stack Overflow
... PM web.1 | ^ 4:29:05 PM web.1 | PrismaClientInitializationError: Query engine library for current platform "darwin" could not be found.
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 >
Query engine (Concepts) - Prisma
From a technical perspective, Prisma Client consists of three major components: JavaScript client library; TypeScript type definitions; A query engine.
Read more >
Database Engine events and errors - SQL Server
251, 16, No, Could not allocate ancillary table for query optimization. ... Use the current activity window in SQL Server Management Studio ...
Read more >
Query Engine Binary For Current Platform "Debian-Openssl ...
X" Could Not Be Found. Since I can't do this override I have to manually edit the default-lambda code using a custom ...
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