New Builds are breaking in runtime with Prisma errors

Hello, As of today morning we’re suddenly seeing our RedwoodJS app fail on Netlify in runtime, with the below error. This is happening for new builds
"Prisma Client could not locate the Query Engine for runtime "rhel-openssl-3.0.x".
This happened because Prisma Client was generated for "debian-openssl-1.1.x", but the actual deployment required "rhel-openssl-3.0.x".
Add "rhel-openssl-3.0.x" to binaryTargets in the "schema.prisma" file and run prisma generate after saving it:
\n\ngenerator client {\n provider = "prisma-client-js"\n binaryTargets = ["native", "rhel-openssl-3.0.x"]\n}

We tried adding more binary targets to the schema file binaryTargets = [“native”, “rhel-openssl-3.0.x”] but then the error changes to
Prisma Client could not locate the Query Engine for runtime "rhel-openssl-3.0.x".
\n\nThis is likely caused by tooling that has not copied "libquery_engine-rhel-openssl-3.0.x.so.node" to the deployment folder.

We’re also seeing that as of this morning, on us-west-1 and -2 and east-1 Netlify is deploying us on node 20 runtime even though our config in netlify shows 18.x.

Please help, as this is greatly impacting development and release velocity.

1 Like

I would like to bump up the priority on this.

I believe the error is due to using different environment for building and runtime. Since prisma invocation during build time does not fail however at runtime fails with missing library.

1 Like

For now, we have pinned the version in .nvmrc to v18 and moved our region to us-east-1. The nvmrc fix is not working in us-west-2 for whatever reason. This seems a temporary fix and we’d like to hear from netlify how to get this to work in a stable fashion. Also, we cannot be in us-east-1 forever since that worsens our latency so we need a fix working in us-west-2. This solution was given to us by members of the RedwoodJS team.

I’m having the same problem. I had to deploy an old commit to resolve the problem since it was associated with an old working build. Now I’m blocked and cannot deploy new updates for my application.

Any update from Netlify team?

@JK19002100, I believe you have also wrote into the helpdesk. So far, no one has let us know how to reproduce this issue, without which, we basically can’t check anything.

@hrishikesh In my case, the problem started with @netlify/build 29.29.4 yesterday. The latest working build was with @netlify/build 29.29.0. I don’t know if this can help in investigating.

The only thing that can help is your site name :slight_smile: and a way to reproduce the issue

You’re right! :grin:

Basically when I call any netlify function which executes a query with Prisma, I got this error:

{"errorType":"PrismaClientInitializationError","errorMessage":"Prisma Client could not locate the Query Engine for runtime \"rhel-openssl-3.0.x\".\n\nThis happened because Prisma Client was generated for \"debian-openssl-1.1.x\", but the actual deployment required \"rhel-openssl-3.0.x\".\nAdd \"rhel-openssl-3.0.x\" to binaryTargetsin the \"schema.prisma\" file and runprisma generate after saving it:\n\ngenerator client {\n provider = \"prisma-client-js\"\n binaryTargets = [\"native\", \"rhel-openssl-3.0.x\"]\n}

You can use this preview to try and see logs:
https://deploy-preview-8--techcompenso.netlify.app/

I tried to set in the schema what it suggests, but the error still appears.
Thanks!

Hi Hrishikesh,
I just sent you a response on the helpdesk chain as well, and I’m pasting it here for reference.
Also, my site is dev.florianworks.com

My response to the helpdesk chain ( with some additions ):

Hi Hrishikesh,

We’re deploying a RedwoodJS project on netlify, to deploy that, you can follow steps in their tutorial in Chapter 1 to set up a project and then Chapter 4 for deployment to Netlify.

The deployments we were testing were PR deployments (deploy previews) that get built when a Pull Request in Github is created or updated.

What we were seeing yesterday was that even with deploy configuration pinned to Node 18, the runtime node version was 20, and that was causing issues with Prisma. To detect this, go to the function logs and see the node version that gets printed in there for the

Below is a copy from the logs as of today morning, where node v20.13 is getting used.

Dec 2, 07:40:32 AM: INIT_START Runtime Version: nodejs:20.v13 Runtime Version ARN: arn:aws:lambda:us-west-2::runtime:0593533e3a90a967b5685780855b7a89f7ba80b7d910603abf59369c6c4c7331

And this leads to the error posted above by me and others, which is not fixed when u add to the binary targets as the error message suggests below.

Prisma Client could not locate the Query Engine for runtime \"rhel-openssl-3.0.x\".\n\nThis happened because Prisma Client was generated for \"debian-openssl-1.1.x\", but the actual deployment required \"rhel-openssl-3.0.x\".\nAdd \"rhel-openssl-3.0.x\" to `binaryTargets` in the \"schema.prisma\" file and run `prisma generate` after saving it

I reached out to the redwood team and they were able to reproduce the issue, following which they asked me to test by changing the .nvmrc file from lts/* to v18 .

While this worked for deployments in us-east-1, it wasn’t working in us-west-2.

So tl;dr: It looks like Netlify is using Node 20 for the function lambdas when configuration is pinned to v18, and that the fix to change the .nvmrc file is working in some regions and not working in other regions.

Additionally: the .nvmrc file has been unchanged (for my project at least) since inception almost a year ago, and that something has changed on Netlify’s end starting sometime on 12/1 to take v20 instead of v18 with this setup and configuration, because my PRs were deploying fine until late 11/30 PST.

However, as of today morning, v18 seems sticky in both these regions, though I will need to confirm after deploying some more PRs and I haven’t tested more regions.

I hope this is enough information for you to debug / reproduce.

Thanks,

Jayesh

So far, I have seen some other issues crop up with the usage of Node.js 20, for example: All nextjs builds returning 500 error with TypeError: file.startsWith is not a function. However, in all these cases, the user had explicitly opted into Node.js 20. @JK19002100 is one of the first people to mention they were not using Node.js 20, but we upgraded them automatically. But, on a closer inspection of your build logs: Deploy details | Deploys | florian-works-dev | Netlify, this happened because you had set the latest LTS to be used as your Node.js version.

@hrishikesh as I mentioned earlier, the code in .nvmrc that had LTS was that way since the beginning of my repo until yesterday. I would like to understand why Netlify began behaving differently yesterday 12/1 when my site config pins node to 18?

Here is a redacted screenshot from my repo showing commit history for .nvmrc and the change done yesterday that was recommended by the RedwoodJS team

Also, as I mentioned before, pinning to v18 in .nvmrc (github screenshots above) did work, but on only us-east-1 yesterday and not on us-west-2 until today morning. It would be good to clarify why it was behaving differently across regions?

Thanks for looking into this.

Node.js has updated LTS to Node.js 20 for a few weeks now. So, that’s not on Netlify. What changed here was, we started supporting Functions on Node.js 20 so instead of using Node.js 18, since you were specifying LTS, we could now start using Node.js 20.

Your site config doesn’t matter if you have an .nvmrc.

That would be most likely a fluke or something trasient. The regions are managed by AWS Lambda anyways and Netlify doesn’t have any control over them.

Okay, this is good to know. Did the support for Functions on Node 20 start yesterday, because that would make complete sense.

Also good to know that .nvmrc overrides site config, is there some place in documentation that we can reference for this? Otherwise it would be good to add to Netlify’s docs.

Thanks!

Yes, this was announced internally and a public announcement was supposed to come along in the coming week, as we didn’t anticipate such “breaking changes”, I believe.

The override part is documented here: Manage build dependencies | Netlify Docs

1 Like

Hey, Prisma here. We are taking a look as well as this should not cause any trouble.

Update: I can reproduce with a non Redwood project, so definitely something off. Will keep you posted. Until then, configuring Netlify to use Node 18 seems like the fix here.

1 Like

Hello from Prisma :slight_smile:
I have a fix in progress for the next release of the CLI (5.7.0), still working on it, more details will follow tomorrow.

You can try out this special work in progress version: npm install prisma@5.7.0-integration-netlify-node20.1
If you try it out let us know if it works, or not, any feedback will be appreciated!

1 Like

Note: We created an issue in the prisma repository Netlify deployment with Node 20 break Prisma (`Prisma Client could not locate the Query Engine for runtime "rhel-openssl-3.0.x"`) · Issue #22244 · prisma/prisma · GitHub

1 Like

There is a newer version to try out the fix here: Netlify deployment with Node 20 break Prisma (`Prisma Client could not locate the Query Engine for runtime "rhel-openssl-3.0.x"`) · Issue #22244 · prisma/prisma · GitHub Please let us know if this works for you!

This change will already be included in our release 5.7.0 tomorrow.

5.7.0 is out and should have a fix for this: Release 5.7.0 · prisma/prisma · GitHub

Can you please try this and confirm?

@JK19002100 @karthiksrinivasan @fabrilallo Did this solve your problem?