DEV Community

Cover image for Prisma: Could not parse schema engine response
Akbar Ali
Akbar Ali

Posted on

Prisma: Could not parse schema engine response

Problem

Recently encountered this error while deploying our app to production:

Error: Could not parse schema engine response: SyntaxError: Unexpected token E in JSON at position 0
Enter fullscreen mode Exit fullscreen mode

There is no more explanation why this occurred, just this line. In the recent merge commit we had only changed a couple of locale keywords, that's it.

Figuring out

Searched all over the internet and found nothing.

Then, I noticed a warning a couple lines of above the error, like this:

prisma:warn Prisma failed to detect the libssl/openssl version to use, and may not work as expected. Defaulting to "openssl-1.1.x".
Enter fullscreen mode Exit fullscreen mode

I searched about this on GitHub and found this:
Prisma fails to find openssl 3.0.x on new bookworm

I realised that for some reasons, the new version of the alpine docker image I was using doesn't come with the openssl package - Which was required for Prisma engine.

Solution

The issue discussion I shared above said that use node version 18.5.something and we can temporarily resolve this or use a different docker image.

But, I don't have to use a different version of node and make conflicts to other packages.

So, I should install the package manually.

This is the docker image I was using:

FROM node:18-alpine
Enter fullscreen mode Exit fullscreen mode

I added these lines to it:

# install openssl
RUN apk update && apk upgrade
RUN apk add --no-cache openssl
Enter fullscreen mode Exit fullscreen mode

And, that solved the problem.

Top comments (4)

Collapse
 
josechifflet profile image
josepe342

Thanks, this was really helpful.

Collapse
 
custom-dev profile image
Dev

Thanks!

Collapse
 
essdeejay profile image
Shreyank Jadiya

This is life saver. We exactly had the same problem and was wondering what could be wrong and found this.

Same issue, no major changes in the app, still docker image was failing in production.

installed these two commands and build went through successfully in production.

Collapse
 
pulimoodan profile image
Akbar Ali

Glad my post could help. Cheers 🥂