Hi all :wave:, Not sure how common this is but we...
# orm-help
m
Hi all đŸ‘‹, Not sure how common this is but we are running a server on Render and use Prisma connected to a Postgres hosted database and we are hitting lots of “Error: Timed out fetching a new connection from the connection pool. More info: http://pris.ly/d/connection-pool (Current connection pool timeout: 10, connection limit: 9)“. We are running a single instance on Render and Starter plan and our service uses a shared
PrismaClient
instance that we export as
client
variable from a shared file. Any tips?
a
If I had to guess, there's some function that's creating new prisma clients instead of reusing a global prisma client
so for example if you have an endpoint like /users that creates a new prisma client within the route handler, you'll run out of connections after that endpoint is visited 10 times
m
yea, I had the same instinct, but that’s not the case (I rechecked) - that’s why I am asking here
i
Is this a dev env db? If you have hot reloading it can force reloading of your prisma client even if it looks like a singleton https://www.prisma.io/docs/support/help-articles/nextjs-prisma-client-dev-practices