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 binary could not be found - netlify & vercel with sveltekit

See original GitHub issue

Bug description

I am receiving the following error with Sveltekit & Vercel (I had the same issue with Netlify, and tried Vercel due to other bug reports saying it solved the problem):

Query engine binary for current platform "rhel-openssl-1.0.x" could not be found.
This probably happens, because you built Prisma Client on a different platform.
(Prisma Client looked in "/var/task/query-engine-rhel-openssl-1.0.x")
Searched Locations:
  /.prisma/client
  /vercel/path0/node_modules/@prisma/client
  /var
  /var/task
  /var/task
  /var/task
You already added the platforms "native", "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.

I am using 2.20.1 due to #6899. Sveltekit uses Vite, so the workarounds in similar bugs raised referencing Next.js & webpack aren’t applicable.

How to reproduce

Add prisma to a sveltekit app and deploy to either netlify or vercel

Expected behavior

Expect prisma client to be able to make requests as per local machine.

Prisma information

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

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

Environment & setup

  • OS: Netlify & Vercel
  • Database: PostgreSQL
  • Node.js version: 14
  • Prisma version: 2.20.1

Issue Analytics

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

github_iconTop GitHub Comments

4reactions
haishanhcommented, May 25, 2021

I have the same issue. Here is a workaround I found.

With SvelteKit’s vercel adapter it bundles the SSR code into a script in .vercel_build_output/functions/node/render.

$ ls .vercel_build_output/functions/node/render
index.js     package.json

The vercel adapter uses esbuild to bundle the SSR script. And esbuild seems to have problem with binary deps, at least it can not resolve Prisma query engine binary file.

We could just add a postbuild script into package.json to copy over relevant files ourselves.

"postbuild": "cp node_modules/@prisma/engines/query-engine-* .vercel_build_output/functions/node/render/;cp prisma/schema.prisma .vercel_build_output/functions/node/render/;ls .vercel_build_output/functions/node/render/",
1reaction
CJ13thcommented, Dec 26, 2021

00:07:29.886 | > cp prisma/schema.prisma .vercel_build_output/functions/node/render/ && cp nodemodules/@prisma/engines/query .vercel_build_output/functions/node/render/

Where is this code from? Are you sure your folder is called nodemodules and not node_modules?

Damn, thanks for spotting!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deploying sveltekit app on vercel, problems (fetching ... - Reddit
It will spit out an error about not being able to find the schema and/or engine files. Solution: Add the following to your...
Read more >
How to deploy a Prisma app to Vercel
In this guide, you will set up and deploy a Next.js app to Vercel. ... To avoid this error, add your Prisma query...
Read more >
Prisma Client Binary Not Copied for Netlify Lambda Functions ...
This was the error mentioned: Invalid `prisma.user.findOne()` invocation: Query engine binary for current platform "rhel-openssl-1.0.x" could not be found. This ...
Read more >
SvelteKit, Vercel and GSAP Business - GreenSock
I am trying to deploy my SvelteKit Website on Vercel, ... Even so, I get an error saying it can't find ScrollTrigger's module....
Read more >
Profile for Netlify - Linknovate
How To Run Your SvelteKit App on Node.js To run your Svelte application on a server ... You can find themes here. cd...
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