Error: remaining connection slots are reserved for non-replication superuser connections. sorry, too many clients already

Hello,

I’ve not been able to resolve it yet.

I’m not sure as to whether it is Strapi or Digital Ocean PostgreSQL Managed Database (in my case) related.

I find it surprising though that I would get this error with only 3 developers working on this at the same time.

Further details, I have been using ssl with the following configuration in database.js:

const fs = require('fs');

const ca = fs.readFileSync(`${__dirname}/ca-certificate.crt`).toString();

module.exports = ({ env }) => ({
  defaultConnection: 'default',
  connections: {
    default: {
      connector: 'bookshelf',
      settings: {
        client: 'postgres',
        host: env('DATABASE_HOST'),
        port: env('DATABASE_PORT'),
        database: env('DATABASE_NAME'),
        username: env('DATABASE_USERNAME'),
        password: env('DATABASE_PASSWORD'),
        ssl: {
          ca,
          rejectUnauthorized: false
        }
      },
      options: {
        ssl: true
      }
    },
  },
});

Will continuing looking into it.