Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query engine library for current platform could not be found. #17996

Closed
baconcheese113 opened this issue Feb 20, 2023 · 2 comments · Fixed by #19330
Closed

Query engine library for current platform could not be found. #17996

baconcheese113 opened this issue Feb 20, 2023 · 2 comments · Fixed by #19330
Labels
bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. team/client Issue for team Client. topic: engine-not-found topic: nx topic: Query engine ... could not be found. Query engine ... for current platform ... could not be found.
Milestone

Comments

@baconcheese113
Copy link

I'm using the Nx monorepo with Prisma and when I attempt to use the PrismaClient instance I get the following error

{
  "data": {},
  "errors": [
    {
      "message": "\nInvalid `prisma.todo.findMany()` invocation in\nC:\\Users\\Name\\Documents\\WebDev\\Personal\\futuristic-example\\apps\\apollo\\src\\schema.ts:15:28\n\n  12 nullable: false,\n  13 args: {},\n  14 resolve: async (_query, _root, _args) => {\n→ 15   return prisma.todo.findMany(\nQuery engine library for current platform \"windows\" could not be found.\nYou incorrectly pinned it to windows\n\nThis probably happens, because you built Prisma Client on a different platform.\n(Prisma Client looked in \"C:\\Users\\Name\\Documents\\WebDev\\Personal\\futuristic-example\\dist\\apps\\apollo\\query_engine-windows.dll.node\")\n\nSearched Locations:\n\n  C:\\Users\\Name\\Documents\\WebDev\\Personal\\futuristic-example\\.prisma\\client\n  C:\\Users\\Name\\Documents\\WebDev\\Personal\\futuristic-example\\node_modules\\@prisma\\client\n  C:\\Users\\Name\\Documents\\WebDev\\Personal\\futuristic-example\\dist\\apps\n  C:\\Users\\Name\\Documents\\WebDev\\Personal\\futuristic-example\\dist\\apps\\apollo\n  C:\\Users\\Name\\Documents\\WebDev\\Personal\\futuristic-example\\apps\\apollo\\prisma\n  /tmp/prisma-engines\n  C:\\Users\\Name\\Documents\\WebDev\\Personal\\futuristic-example\\dist\\apps\\apollo\n\nYou already added the platforms \"windows\", \"debian-openssl-1.1.x\", \"debian-openssl-3.0.x\", \"linux-musl\", \"linux-musl-openssl-3.0.x\" to the \"generator\" block\nin the \"schema.prisma\" file as described in https://pris.ly/d/client-generator,\nbut something went wrong. That's suboptimal.\n\nPlease create an issue at https://github.com/prisma/prisma/issues/new",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "todos"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "stacktrace": [
          "Error: ",
          "Invalid `prisma.todo.findMany()` invocation in",
          "C:\\Users\\Name\\Documents\\WebDev\\Personal\\futuristic-example\\apps\\apollo\\src\\schema.ts:15:28",
          "",
          "  12 nullable: false,",
          "  13 args: {},",
          "  14 resolve: async (_query, _root, _args) => {",
          "→ 15   return prisma.todo.findMany(",
          "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 \"C:\\Users\\Name\\Documents\\WebDev\\Personal\\futuristic-example\\dist\\apps\\apollo\\query_engine-windows.dll.node\")",
          "",
          "Searched Locations:",
          "",
          "  C:\\Users\\Name\\Documents\\WebDev\\Personal\\futuristic-example\\.prisma\\client",
          "  C:\\Users\\Name\\Documents\\WebDev\\Personal\\futuristic-example\\node_modules\\@prisma\\client",
          "  C:\\Users\\Name\\Documents\\WebDev\\Personal\\futuristic-example\\dist\\apps",
          "  C:\\Users\\Name\\Documents\\WebDev\\Personal\\futuristic-example\\dist\\apps\\apollo",
          "  C:\\Users\\Name\\Documents\\WebDev\\Personal\\futuristic-example\\apps\\apollo\\prisma",
          "  /tmp/prisma-engines",
          "  C:\\Users\\Name\\Documents\\WebDev\\Personal\\futuristic-example\\dist\\apps\\apollo",
          "",
          "You already added the platforms \"windows\", \"debian-openssl-1.1.x\", \"debian-openssl-3.0.x\", \"linux-musl\", \"linux-musl-openssl-3.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.",
          "",
          "Please create an issue at https://github.com/prisma/prisma/issues/new",
          "    at Kr.handleRequestError (C:\\Users\\Name\\Documents\\WebDev\\Personal\\futuristic-example\\node_modules\\@prisma\\client\\src\\runtime\\RequestHandler.ts:225:13)",
          "    at Kr.handleAndLogRequestError (C:\\Users\\Name\\Documents\\WebDev\\Personal\\futuristic-example\\node_modules\\@prisma\\client\\src\\runtime\\RequestHandler.ts:173:12)",
          "    at C:\\Users\\Name\\Documents\\WebDev\\Personal\\futuristic-example\\node_modules\\@prisma\\client\\src\\runtime\\getPrismaClient.ts:1135:23",
          "    at processTicksAndRejections (node:internal/process/task_queues:95:5)",
          "    at C:\\Users\\Name\\Documents\\WebDev\\Personal\\futuristic-example\\node_modules\\@prisma\\client\\src\\runtime\\getPrismaClient.ts:1142:24",
          "    at t._executeRequest (C:\\Users\\Name\\Documents\\WebDev\\Personal\\futuristic-example\\node_modules\\@prisma\\client\\src\\runtime\\getPrismaClient.ts:1061:33)",
          "    at t._request (C:\\Users\\Name\\Documents\\WebDev\\Personal\\futuristic-example\\node_modules\\@prisma\\client\\src\\runtime\\getPrismaClient.ts:1036:14)"
        ]
      }
    }
  ]
}

You can reproduce the error with the following repo https://github.com/baconcheese113/futuristic-example/tree/6eda2d1b5ed87c2032a3ce3a4a8b7e229d218b15

  1. Install dependencies
  2. npx nx startup apollo
  3. Use Apollo Server to query todos
@jkomyno jkomyno added bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. topic: engine-not-found team/client Issue for team Client. kind/bug A reported bug. labels Feb 20, 2023
@baconcheese113
Copy link
Author

This issue helped me work around this problem by adding output to my generator

generator client {
  provider = "prisma-client-js"
  output = "../../../node_modules/.prisma/client"
}

However, this feels a bit hacky and given how many users will likely run into the problem....perhaps the error message could at least be improved?

@janpio janpio added topic: nx topic: Query engine ... could not be found. Query engine ... for current platform ... could not be found. labels Feb 24, 2023
@millsp millsp added this to the 4.15.0 milestone May 24, 2023
@millsp
Copy link
Member

millsp commented May 31, 2023

Hey, we wanted to give you an update about this. We have around 10 issues that we have identified to be in the "engine not found" category. Looking at these, we learned that there are four main categories responsible for these errors:

  • Your client was generated with native (default) on one platform, but used on a different platform at runtime.
  • You pinned binaryTargets incorrectly, and the correct engine was therefore not included at runtime.
  • A bundler/framework changed the Prisma Client but did not copy the necessary engine for the runtime.
  • Deployment/tooling did not copy the engine correctly so the correct engine was not included at runtime.

These cases were previously not detected. On top of that, the error messages were confusing and were neither helpful for you or us. With that, it is likely that many of the cases above overlapped each other. So while we cannot fix a missing engine, we can detect how and why it happened. Thanks to that, we now display more useful errors to help you out of trouble. And in some cases, we will ask some input from you to learn more about your project so we can further improve.

If something is still off for you, feel free to create a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. team/client Issue for team Client. topic: engine-not-found topic: nx topic: Query engine ... could not be found. Query engine ... for current platform ... could not be found.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants