`SyntaxError: Unexpected end of JSON input` with Prisma 2.x and specific Node version(s)
See original GitHub issueBug description
Since this morning all my call to model.findMany are giving me this error when running on Heroku:
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
Issue Analytics
- State:
- Created a year ago
- Reactions:9
- Comments:19 (3 by maintainers)
Top Results From Across the Web
SyntaxError: Unexpected end of JSON input when a fuction ...
-- The Unexpected end of JSON input error occurs when you try to parse an invalid JSON string or an empty array, like...
Read more >[Windows] prisma2 init Unexpected end of JSON input #483
Hello Team Prisma ! I just tried the new preview of prisma2 on Windows and when i execute the prisma2 init cmd, I...
Read more >“Unexpected end of JSON input” – possible fixes - LinuxPip
“Unexpected end of JSON input” (or “Uncaught SyntaxError: Unexpected end of JSON input”) is a common error message in JavaScript, ...
Read more >Uncaught SyntaxError: Unexpected end of JSON input
A common error encountered by JavaScript programmers is the Uncaught SyntaxError: Unexpected end of JSON input. This is usually observed when the coder...
Read more >unexpected end of json input while parsing near - Code Grepper
error Unexpected end of JSON input while parsing near '... ... This is not a definitive answer but it looks like your global...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub 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.