netlify/zip-it-and-ship-it

Next & Prisma: Query engine binary for current platform "rhel-openssl-1.0.x" could not be found.

abereghici opened this issue · 7 comments

Describe the bug

I'm using next@11.1.0 with prisma@2.30.0 and I'm trying to deploy it on Netlify (serverless). Locally is working okay, but when I'm deploying it I have the following error:

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/netlify/functions/next_api_views/nextPage/chunks/query-engine-rhel-openssl-1.0.x") Searched Locations: /var/task/netlify/functions/.prisma/client /home/runner/work/bereghici.dev/bereghici.dev/common/temp/node_modules/.pnpm/@prisma+client@2.30.0_prisma@2.30.0/node_modules/@prisma/client /var/task/netlify/functions/next_api_views/nextPage /var/task/netlify/functions/next_api_views/nextPage/chunks /var/task/netlify/functions/next_api_views/nextPage/chunks /tmp/prisma-engines /var/task/netlify/functions/next_api_views/nextPage/chunks 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. Please create an issue at https://github.com/prisma/prisma/issues/new

To Reproduce

Steps to reproduce the behavior:

Create a simple serverless NextJS app with Prisma

Configuration

netlify.toml

[build]
  command = "npm run build"
  publish = "out"
[functions]
  node_bundler = "esbuild"
  external_node_modules = ["@ampproject/toolbox-optimizer", "sharp", "next"]
npx envinfo --system --binaries --npmPackages netlify-cli --npmGlobalPackages netlify-cli

  System:
    OS: macOS 10.15.7
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Memory: 52.88 MB / 32.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.17.2 - /usr/local/bin/node
    Yarn: 1.22.0 - /usr/local/bin/yarn
    npm: 6.14.13 - /usr/local/bin/npm

Expected behavior

Prisma client should work on Netlify.

Additional context

You can see the error here: https://6128d3ecc5a191be338765d7--development-bereghicidev.netlify.app/api/views

Source code: https://github.com/abereghici/bereghici.dev/tree/prisma/apps/blog

I've created a repository where the issue can be reproduced: https://github.com/abereghici/nextjs-prisma-test

It's working fine with next target: experimental-serverless-trace, the issue appears only with the serverless target.

@abereghici The prisma branch you linked to doesn't seem to exist anymore. Were you able to solve the problem?

@eduardoboucas I have created another repository where the issue can be reproduced: https://github.com/abereghici/nextjs-prisma-test
As I said in the previous comment, the issue appears only with serverless target.

@eduardoboucas I have created another repository where the issue can be reproduced: https://github.com/abereghici/nextjs-prisma-test
As I said in the previous comment, the issue appears only with serverless target.

Doh, I missed your follow up comment. Sorry! I'll look into it and report back.

@eduardoboucas no problem. I deployed with serverless target the project https://github.com/abereghici/nextjs-prisma-test and here is the result https://next-prisma-test.netlify.app/api/views

This is likely an upstream issue with Prisma. I opened a PR for it. Until that's merged, you can either use experimental-serverless-trace or patch Prisma manually using this (very hacky) workaround: abereghici/nextjs-prisma-test@main...netlify-team-account-1:main

Please let me know if that works for you 🙌

Prisma PR was merged and published in prisma@3.1.0-dev.27. Closing this issue, feel free to reopen if that doesn't help :)