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.

Nextjs function can't find binary on Netlify

See original GitHub issue

Bug description

Nextjs project deployed to netlify give giving me error on function. I already cleared the cache on my build process and added.

Build step prisma generate && next build using yarn.

Prisma information

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

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

Environment & setup

  • OS: Debian (netlify)
  • Database: MySQL
  • Prisma version: 2.21.2
PrismaClientInitializationError2 [PrismaClientInitializationError]: 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 "/query-engine-rhel-openssl-1.0.x")

Searched Locations:

  /.prisma/client
  /opt/build/repo/node_modules/@prisma/client
  /
  /var/task/node_modules/.prisma/client
  /var/task
  /tmp/prisma-engines
  /var/task/node_modules/.prisma/client

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.

Please create an issue at https://github.com/prisma/prisma/issues/new
    at cb (/var/task/src/nextPage/index.js:40268:17)
    at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  clientVersion: '2.21.2',
  errorCode: undefined
}

I am also using the db.ts specified in the next instructions:

declare global {
  namespace NodeJS {
    interface Global {
      prisma: any;
    }
  }
}

let prisma: PrismaClient

if (process.env.NODE_ENV === 'production') {
  prisma = new PrismaClient()
} else {
  if (!global.prisma) {
    global.prisma = new PrismaClient()
  }
  prisma = global.prisma
}
export default prisma

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
pedrosousa13commented, Apr 20, 2021

@janpio I’m getting whenever I try to access the function via any http request.

0reactions
pantharshit00commented, Jun 2, 2022

I am going to close this. Please follow the latest netlify deployment guide from the documentation here now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Query engine binary could not be found on netlify deployment ...
Bug description Query engine binary for current platform "rhel-openssl-1.0.x" could not be found. This probably happens, because you built ...
Read more >
Troubleshooting Next.js on Netlify
Troubleshoot your Next.js application on our platform. Fix issues with large functions and dependencies.
Read more >
Netlify won't deploy my Next.js+Prisma app
I'm having trouble deploying this basic Next.js app with Prisma to ... Prisma Client Binary Not Copied for Netlify Lambda Functions (For ...
Read more >
Application deployed but with Errors 500 on pages where ...
I have a simple static blog using NextJS 13. I use getStaticProps on all of my pages. It works during development but the...
Read more >
How to Include Files in Netlify Serverless Functions
A better approach is to find every require and import call in the code and mark each referenced file as being required for...
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