Prisma: Error querying the database: db error: FATAL: too many connections

Viewed 2330

I am using Prisma as ORM in my nextjs app. I am initiating the Prisma client in a lib file and importing the same where ever i need the instance. But still am getting the following error.

Error querying the database: db error: FATAL: too many connections for role "qcjoaamjgbnxjx"

prisma-client:

import { PrismaClient } from '@prisma/client';

const prisma = new PrismaClient();
export default prisma;
2 Answers

You could try instantiating PrismaClient as shown here so that a new connection isn't created on every reload.

I got the same error in my local computer. but my error was due to I have opened too many panels in pgAdmin. my database is Postgres. after removing all panels. my issue is solved

Related