What did you change with Postgres Deployments?

In the past 2 days I have had all sorts of nightmares with Koyeb. For some reason the connection string no longer works from my production Koyeb Server but works fine completely locally… I have tried about everything now and at this point I am convinced it is your issue entirely and something has changed in the past few days which has completely killed my prod server:

“Timed out fetching a new connection from the connection pool. More info: Connection pool | Prisma Documentation (Current connection pool timeout: 10, connection limit: 3)”

issue I am having, I have also now tried about 20+ different combination of connection strings, removing pgbouncer, setting it to false, changing timeouts, pool size, connection limits and nothing works.

I have also changed my instance to a bigger instance and all the RAM, CPU usage etc is all under the max cap so this is also not the issue. I have updated my Prisma connection client for prod and no change. As stated before everything is working locally no issue but my Koyeb Server cannot connect/is having these problems:

Invalid `prisma.loginAttempt.deleteMany()` invocation:
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: 3)
    at async n.checkRateLimit (.next/server/app/api/agents/create/route.js:1:4248)
    at async Object.authorize (.next/server/app/api/agents/create/route.js:1:5230)
    at async Object.c (.next/server/chunks/712.js:25:4504)
    at async g (.next/server/chunks/712.js:1:105587)
    at async a (.next/server/chunks/712.js:25:18496)
    at async e.length.t (.next/server/chunks/712.js:25:19986) {
  clientVersion: '6.3.0',
  errorCode: undefined
}

I am slowly losing my mind now and have spent the last 4 hours trying all manner of things but I cannot login/complete a valid auth flow which worked a few days ago without any changes on our side happening. Locally it all works fine so at this point I am absolutely baffled as to what is going on and can only point the finger to something you have changed. I also do not appreciate not being able to view metrics for my DB instance on Koyeb, such as usage metrics as I have no way to track down what is going with it. I have checked my max connections which is around 110+ I believe and currently only 17 being used all around from different servers pointing/using it.

I need immediate help and an explanation as to what is going on at Koyeb and if any changes have been made recently. You also recommend this pgbouncer system but do not talk about it anywhere in your docs which is not helpful. Changing this setting to false, removing it entirely seems to not change it at all and it looks like you are basically overriding what is my env variable/connection.

Instance created. Preparing to start...
Starting download for REDACTED
Download progress: 100% |e[32m++++++++e[0m| (51.7 MiB/s)
Instance is starting... Waiting for health checks to pass.

> REDACTED
> next start

   ▲ Next.js 15.1.5
   - Local:        http://localhost:8000
   - Network:      http://10.3.15.107:8000

 ✓ Starting...
 ✓ Ready in 671ms
>>> DATABASE_URL at runtime: REDACTED?sslmode=require&connect_timeout=10&poolSize=10
Instance is healthy. All health checks are passing.
Rate limit check failed: Error [PrismaClientInitializationError]: 
Invalid `prisma.loginAttempt.deleteMany()` invocation:


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: 3)
    at async n.checkRateLimit (.next/REDACTED:1:4248)
    at async Object.authorize (.next/REDACTED:5230)
    at async Object.c (.next/server/chunks/712.js:25:4504)
    at async g (.next/server/chunks/712.js:1:105587)
    at async a (.next/server/chunks/712.js:25:18496)
    at async e.length.t (.next/server/chunks/712.js:25:19986) {
  clientVersion: '6.3.0',
  errorCode: undefined
}
prisma:error 
Invalid `prisma.loginAttempt.deleteMany()` invocation:


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: 3)
prisma:error 
Invalid `prisma.user.findUnique()` invocation:

You see what is this now? You forcing DB pooling without my knowledge, max connection limit of 3?

What I need to know is: Is your managed Postgres in transaction pooling mode with a strict concurrency limit? If so how do I stop this, and why do you do this in the first place? You basically just took down my whole production server with this as concurrency started getting used, and now I have no feasible way to fix this without migrating to a new company entirely.

The default size of the Prisma connection pool is determined by the following formula: num_physical_cpus * 2 + 1 , where num_physical_cpus represents the number of physical CPUs on the machine where your application runs.

You can specify the number of connections explicitly by setting the connection_limit parameter in your database connection URL. For example:

DATABASE_URL="postgresql://[user]:[password]@[db_hostname]/[dbname]?sslmode=require&connect_timeout=15&connection_limit=20"

Let me know if it helps.

Hi there, this only worked for me when disabling pgbouncer. I believe pgbouncer is enforcing that default calculation to occur, not 100% on this but I tried a lot. I would like to also note that when doing this change, it did not work instantly and after coming back to the web app after 8 hours or so it was now working. Not sure what is going on if there is some connection caching layer but it would be great if this could be looked into. I also do not see the usecase or reason pgbouncer is put into the default connection string recommendation from yourselves, some incite or docs on this would be useful.

You have usualy to different connection string. One to use connection pooling using pgbouncer, and one direct connection without using pgbouncer.

If you do not want to use pgbouncer, you should use the direct URL.

Here is the documentation for Prisma and Neon database which is the underlying solution we propose: Neon | Prisma Documentation