I’m running into an issue where I’m hitting 20/20 ...
# orm-help
p
I’m running into an issue where I’m hitting 20/20 connections on my hobby-dev database, and i’m the only one using the website right now. how can i solve this? i’m using the
prisma.$disconnect()
method on all api endpoints, so i’m confused as to why this is an issue Edit: I read some of the docs, and I set a global
prisma
client, and removed all of the
$disconnect
calls. It still seems to eat up the connections quickly, though.
k
I use the hack found in the doc for my nextjs site and it works. Yes, I also confused by the
$disconnect
method, I always assume that will solve this particular issue if I do it on all api endpoints.
p
what’s the “hack”?
If that doesn’t work, you may try this
Copy code
import { PrismaClient } from "@prisma/client";

const prisma = new PrismaClient({
  log: process.env.NODE_ENV === "development" ? ["query", "info", "warn"] : [],
});

export { prisma, PrismaClient };