joshua
09/18/2021, 2:18 PMimport { PrismaClient } from "@prisma/client";
interface CustomNodeJsGlobal {
prisma: PrismaClient;
}
declare const global: CustomNodeJsGlobal;
const prisma = global.prisma || new PrismaClient();
if (process.env.NODE_ENV === "development") global.prisma = prisma;
export default prisma;
after 10-15 mins of development i keep getting this error:
Error querying the database: db error: FATAL: remaining connection slots are reserved for non-replication superuser connections
at cb (/Users/joshua/Desktop/next-prisma/node_modules/@prisma/client/runtime/index.js:36946:17)
my DB is set up on digital ocean and my DB URL looks like this:
<postgresql://USER_NAME:PASSWORD@HOST>:PORT/DATABASE?sslmode=require
any tips on how i can eliviate this?Ryan
09/20/2021, 6:35 AMjanpio
janpio
janpio
janpio
Ryan
09/20/2021, 10:35 AMjoshua
09/20/2021, 1:44 PMyarn dev for nextjs seems to help for the 10-15 mins i am able to develop. i will look into closing connections with a superuserjanpio
yarn dev is not reusing or closing the connections as it should. If you have a reproduction, might be worth creating an issue.