- Strapi Version: 3.6.8
- Database: Postgres (pg ^8.7.1)
- Node Version: 12.22.12 (Hosted on Render.com)
TLDR; I can not add any setting to the options.pool settings because this inherently blocks Strapi from connecting to my postgres db with
Today morning my Strapi Service, hosted on Render.com went down due to the following knex error:
KnexTimeoutError: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?
After a couple of min the server healed itself but I already had the issue 2 weeks ago and I attribute it to the fact that given the amount of traffic there might be too few connection pools open. Render allows 97 but Strapi’s default settings have 10.
So my rational was to increase the max pool size to 30 and see if it improves the issue.
According to Strapi v3 there’s an
options.pool setting where I should be easily able to adjust the settings.
As soon as the deploy is successfully built and Strapi wants to start I get the “ECONNREFUSED” error indicating that there might be a problem connecting to the postgres db:
And in fact, whenever there’s something in the options.pool object Postgres seems to do a restart?! which inherently causes the connections issues (I think)
I first tried it with (min: 2, max: 30) then with (min:0, max:30 + all the options below) all basically lead to the same issue… In addition, I also noticed that the connection activity spikes as soon as I deploy the new update.
Strapi Web Service Specs: 1 GB RAM, 1 GB CPU
Postgres Specs: 256 MB RAM | Shared | 1 GB CPU | 97 connections
I would highly appreciate your help as I don’t know what to do anymore… Thanks!