Strapi Postgres Connection Pool breaks connection

Yes I agree, it is not acceptable.

nevertheless it only happens when a content model change is required (changed / added / deleted fields/content types). Other changes (controller logic, strapi updates, etc.) are fine and the server starts quite fast without any issues.

My emergency workaround (when redeploy does not help at all) right now is:

  • “suspend” the strapi node instance. (No idea how fast this is, never needed to do this workaround so far). But it is needed - else it restarts and re-applys old code and crashes I guess.
  • do a pg_dump of the production database (I always do this before deploying ofc.).
  • Then start strapi with the production db locally. This will apply all database structure changes without any issues quite fast.
  • Then do pg_restore back to production.
  • Push strapi code to github
  • reactivate node server.

I want to say I am absolutely not a fan of this but if nothing else works this should do the job…

I will let you know once I tested the bigger database plan on render. Maybe this just “fixes” the issues.

Would appreciate your further experiences with this issue, too, if you have some.

2 Likes