Harsha M V
Harsha M V

Reputation: 54949

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

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;

Upvotes: 7

Views: 14188

Answers (2)

Aneesh
Aneesh

Reputation: 141

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

Upvotes: 2

Ryan
Ryan

Reputation: 6347

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

Upvotes: 11

Related Questions