Postgres error: "remaining connection slots are reserved for non-replication superuser connections"

Hello community!
The following problem occurs:
I’m using Supabase and connecting to it via a Postgres node. In recent days, such an error began to appear in response to SQL queries: “remaining connection slots are reserved for non-replication superuser connections”.
As I was able to figure out, the reason is related to the use of PGbouncer and the mode setting.
Maybe someone from the community or the n8n team came across this error and was able to solve it?

The number of active connections is always 1, I did tests and could not get more than 2 active connections at one time.


Hi @Roket, I am afraid I have not come across this problem, but I’ve asked internally for help on this one.

1 Like

Hey @MutedJam ! Thanks!

1 Like

Hey @Roket,

Is this a self hosted instance of Postgres and Supabase or is it the cloud version? When connecting to the database are you also using the normal connection string under Settings > Database > Connection Info or the Database Pooling connection info from Settings > Database > Connection Pooling?

1 Like

Hi @Jon !
I use the cloud version of Supabase and connect in the usual way.

Hey @Roket,

Could be worth trying the connection pooling option at the bottom of the page.

2 Likes

Ok, I’ll try to set it up. Thanks for the help!

@Jon can you make an example of the connection pooling in n8n workflow? So, I understand that this should be done not through the standard settings of the credIntals in the Postgres node, but somehow differently?

Hey @Roket,

When I have it a go this morning I just setup up the Postgres credentials to use the host and port from the pooling option and just used the node as normal. Did this not work for you?

1 Like

I used the “host” value from the normal connection and “port” from the pooling connection. In fact, I only changed the port number. Now everything works. Is this the correct setting?

Hey @Roket,

I used all the values from the connection pooling option but looking at it now it looks like the only difference is the port.

2 Likes

@Jon , thank you so much for your help!

2 Likes

@Roket no problem, I take it all is working now?

1 Like

Yes, everything works!

1 Like