Hi! I'm using Supabase (hosted/pro) with a NextJS...
# help
r
Hi! I'm using Supabase (hosted/pro) with a NextJS/Prisma app deployed on Vercel with API serverless functions. Even though I've followed Prisma serverless guide https://www.prisma.io/docs/guides/performance-and-optimization/connection-management#serverless-environments-faas and using pgbouncer provided by Supabase, I'm running into
PrismaClientInitializationError: Error querying the database: db error: ERROR: no more connections allowed (max_client_conn)
with a really small traffic. Any hint on where the problem may come from or how to investigate? With no access to pgbouncer or the PG connection details, it's hard to understand what's going on. Been on this problem for almost a week now, I can't find anything... Thanks in advance šŸ™
d
Hi @rchampourlier we have this guide with Redwood and pooling that might help: https://redwoodjs.com/docs/connection-pooling
r
Hi @User , thanks for the reply! I've looked at most (if not all) available guides, but afaik, I have the right config and Prisma is going through pgbouncer to the Supabase db. My worry is that there's some issue with pgbouncer's config but since I cannot investigate (no access to the config nor pgbouncer management admin), I'm a bit stuck. The only next step I can see is going for another DB hosting solution with more control over the DB/pgbouncer, so if you have anything I can look at before I've to go that way, it will be welcome šŸ™
Just got a reply from the support, sharing it as it may help others in this situation: > At the moment, users are not able to access PgBouncer statistics. We're working on making this a feature in the future along with making PgBouncer logs visible to users in order to provide you guys more visibility when debugging. There is no definite timeline for these at the moment but we can update you once these features become available. ​ > For now, we've taken a look under the hood and can confirm that the setting for max_client_conn of PgBouncer is 100 by default. As such it it could be likely that your hypothesis is correct wherein stale connections are in play and are pushing the number of client connections close or even above 100. I'm waiting for their reply on how this setting could be adjusted to make pgbouncer useful (I'm assuming it's useless right now, providing only 100 connections will not get a serverless-deployment far).