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

@gkkirilov Actually, even with the connection pooling set up as so: (note: options.pool)

return ( {
        defaultConnection: 'default',
        connections: {
            default: {
                connector: 'bookshelf',
                settings: {
                    client: 'postgres',
                    host: `${dbSocketPath}/${env( 'INSTANCE_CONNECTION_NAME' )}`,
                    database: env( 'DATABASE_NAME' ),
                    username: env( 'DATABASE_USERNAME' ),
                    password: env( 'DATABASE_PASSWORD' ),
                },
                options: {
                    pool: {
                        min: 0,
                        max: 7,
                    },
                },
            },
        },
    } )

the limit was still being hit. I ended up configuring the instance to use 1.7 GB of memory (and ensured that the max_connections was 50) and that seems to have solved the problem so far.

Best,
RM