You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{PrismaClient}from"@prisma/client"export*from"@prisma/client"letprisma: PrismaClientif(process.env.NODE_ENV==="production"){prisma=newPrismaClient()}else{// Ensure the prisma instance is re-used during hot-reloading// Otherwise, a new client will be created on every reloadglobalThis["prisma"]=globalThis["prisma"]||newPrismaClient()prisma=globalThis["prisma"]}exportdefaultprisma
Right now with that code this plugin is worthless, because prisma doesn't get reinstantiated.
Proposal
On prisma schema change, in addition to clearing the require cache, also delete global.prisma and globalThis.prisma
The text was updated successfully, but these errors were encountered:
According to https://github.com/prisma/prisma-client-js/issues/228#issuecomment-618433162, we must use the below code in next.js environments to prevent the too many connections error.
Right now with that code this plugin is worthless, because prisma doesn't get reinstantiated.
Proposal
On prisma schema change, in addition to clearing the require cache, also delete
global.prisma
andglobalThis.prisma
The text was updated successfully, but these errors were encountered: