You can configure the connection_limit and pool_timeout parameters while passing them in the connection string. You can set the connection_limit to 1 to make sure that prisma doesn't initiate new database connections, this way you won't get timeout errors.
Increasing the pool timeout would give the query engine more time to process queries in the queue.
Reference for connection_limit and pool_timeout parameters: Reference.
Answer from Nurul Sundarani on Stack OverflowSpecify a query timeout for the client
nestjs - Timed out fetching a new connection from the connection pool prisma - Stack Overflow
Make transaction timeouts configurable _globally_ when calling `new PrismaClient()`
Support globally setting or disabling interactive transaction timeout
You can configure the connection_limit and pool_timeout parameters while passing them in the connection string. You can set the connection_limit to 1 to make sure that prisma doesn't initiate new database connections, this way you won't get timeout errors.
Increasing the pool timeout would give the query engine more time to process queries in the queue.
Reference for connection_limit and pool_timeout parameters: Reference.
While changing the connection_limit can help, as mentioned, you might be hiding a bigger issue, and kicking the can down the road.
This link can be helpful in debugging what the underlying issue is that's causing the time out.
The following is two potential causes that seemed relevant to our case.
- We found that using Promise.all can cause this issue, as it seems to create new connections. (Promise.all has caused other issues in relation to Prisma. Specifically taking time to establish a connection. See here)
- Having a long running query.