Intermittent Server Error with Prisma 6.2.1 with Node 22 on Linux Mint
I am building NextJS application with Prisma on Linux Mint and have recently starting getting intermittent errors when running the application on localhost. For example, if I change a file and spark a hot module replacement, SOMETIMES it will give me an error on the console saying : (see attached)
And I get an unhandled exception on the browser saying: (see attached)
`
indicating that there is some issue with my Prisma client. (Yes, I have regenerated Prisma several times)
And I get message on the network debug panel (see attached)
This seems to only be an issue on Linux (I am running Mint 22). When I do the same on my Windows 11 laptop, I am not seeing this error. Also, when I build and deploy the application to Vercel, I do not get the issue. This happens ONLY on my locahost after running to run the app for debugging. I cannot tell if this is an issue with Prisma, Node, or Linux.
It only happens intermittently. Sometimes I just refresh the page and it works again and I cannot seem to reproduce the error consistently after several tries.
This is happening on a page where Prisma is executing a simple query to retrieve about 7 records from the database and render them to the page. When I remove this query, I no longer get the error, making me think that the Prisma query is sometimes causing the error.
Any suggestions would be much appreciated. Is there something I'm not seeing? OS: Linux Mint 22 Node: 22.13.1 Framework: NextJS
It only happens intermittently. Sometimes I just refresh the page and it works again and I cannot seem to reproduce the error consistently after several tries.
This is happening on a page where Prisma is executing a simple query to retrieve about 7 records from the database and render them to the page. When I remove this query, I no longer get the error, making me think that the Prisma query is sometimes causing the error.
Any suggestions would be much appreciated. Is there something I'm not seeing? OS: Linux Mint 22 Node: 22.13.1 Framework: NextJS
3 Replies
You decided to hold for human wisdom. We'll chime in soon! Meanwhile,
#ask-ai
is there if you need a quick second opinion.How are you importing/instantiating the PrismaClient?
Have you tried logging the full
JSON.stringify(error)
to see what’s being returned?
I am wondering if this could be something due to HMR, can you temporarily disable HMR and see if the issue persists?Thanks @Nural(Prisma), Well, I looked up disabling HMR and that looked more difficult, so I just separately did an
pnpm build
and then pnpm start
to run the app without HMR. Then stringifying the error message gave me only an object like { digest: '520418415' }
with no other information. At first caused it to error out every time. Then I regenerated prisma with npx prisma generate
and then built and started again. After I did that, the intermittent problem stopped and I no longer get the error. I can now just run pnpm dev
and use the HMR and it appears to be fine. I really have no idea what I did or what caused this, but I'm just afraid it will come back. (Well, it did the next day!) FYI, here is my package.json file that I hope answers your quesiton on how I'm including prisma.{
"name": "@repo/database",
"version": "0.0.0",
"main": "./index.ts",
"types": "./index.ts",
"scripts": {
"analyze": "prisma generate --no-hints",
"build": "prisma generate --no-hints",
"clean": "git clean -xdf .cache .turbo dist node_modules",
"typecheck": "tsc --noEmit --emitDeclarationOnly false"
},
"dependencies": {
"@neondatabase/serverless": "^0.10.4",
"@prisma/adapter-neon": "^6.2.1",
"@prisma/client": "6.2.1",
"@t3-oss/env-nextjs": "^0.11.1",
"server-only": "^0.0.1",
"undici": "^7.3.0",
"ws": "^8.18.0",
"zod": "^3.24.1"
},
"devDependencies": {
"@repo/typescript-config": "workspace:*",
"@types/node": "22.10.7",
"@types/ws": "^8.5.14",
"bufferutil": "^4.0.9",
"prisma": "6.2.1",
"typescript": "^5.7.3"
}
}
@Nurul (Prisma). An update. I found that there may be incompatibiliites between Prisma and Linux Mint in dev? Will be swithing to Ubuntu to see if that addresses the issue. When I run the same NextJS application in Dev on Windows 11, no problems.