prisma: `SyntaxError: Unexpected end of JSON input` with Prisma 2.x and specific Node version(s)

Bug description

Since this morning all my call to model.findMany are giving me this error when running on Heroku:

Screenshot 2022-08-16 at 15 04 31

But it’s working fine when i’m running my project locally. It’s the same code on heroku but the findMany calls are not working…

This is the of code for the above error:

    const pendingBets = await prisma.bet.findMany({
        where: {
            status: 0
        },
    });

Environment & setup

  • OS: MacOs
  • Database: PostgreSQL
  • Node.js version: 16.15.0

Prisma Version

2.30.3

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 8
  • Comments: 20 (3 by maintainers)

Commits related to this issue

Most upvoted comments

This broke for us (using Prisma v2.30.3) when upgrading from Node v16.16 to v16.17 (released Aug 16, 2022). Pinning Node to v16.16 fixed the issue. It appears Node updated its JSON escape sequences to align with the JSON spec (\v, specifically) and v2 of Prisma seems to reference that escape sequence in its code.

Changelog: https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V16.md#16.17.0 PR: https://github.com/nodejs/node/pull/43206 Commit: https://github.com/nodejs/node/commit/486dcd7c69b3601252373cca7a132b67a0125fb8

And closing the issue to signal that there is nothing for us to do.

Everyone finding this via Google, please read above how to fix this (upgrade Prisma or change Node version). Thanks.

Godd suggestion - done.

@janpio no, thanks, since this is isolated to specific older version combinations of Prisma and Node, I wouldn’t expect anything to be done from Prisma other than keeping the issue discoverable for others who might run into it. It might help to make the issue title slightly more generic, as our issue wasn’t with “findMany” specifically. “Unexpected end of JSON input” is the bit that helped me locate this GitHub issue. We’ve already been planning to upgrade Prisma to a more recent version - this just provides some extra motivation 🙂

@trek We’re on fly.io.

This also started occurring for me this about 7 hours ago. I opened a ticket at Heroku as well.