Help connecting N8n with supabase database PostgreSQL

Hi, I am trying to configure n8n with supabase as a postgredb database. It is each in a separate docker container. I have the database created in supabase but I can’t connect when I open the docker-compose-n8n.yml file with this data. It returns Error: connect ECONNREFUSED .

According to chat gpt is that it can’t connect to the host and port.

I tried using the host with the container name, with “localhost”, with the server ip, with ip .

The port shows LISTEN with netstat -an | grep 5432

Can anyone think what it could be? Has anyone already configured it this way successfully?

This is how I have the variables in the docker-compose.yml file:

version: ‘3.1’
image: n8nio/n8n
container_name: n8n

DB_TYPE: “postgresdb”
POSTGRESDB_DATABASE: “n8n” # Name of your database
POSTGRESDB_HOST: “supabase-db” # Name of the container
POSTGRESDB_PORT: “5432” # PostgreSQL Port
POSTGRESDB_USER: “n8n_user” # Database user
POSTGRESDB_PASSWORD: “n8n_password” # User’s password
external: true

Information on your n8n setup

  • n8n version: Last one
  • Database (default: SQLite): PostgreSQL
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • **Running n8n via Docker **
  • Operating system: Ubuntu 22.04

hi @Sebastian_Kopalek

What is the output of docker port n8n and docker port supabase-db commands?

Plus, if both containers run on the same server, then the POSTGRESDB_HOST variable should be set to localhost or server name. supabase-db won’t work if it is not in the /etc/hosts file on the server

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.