Connection refused when connecting postgres and supabase to n8n
Hello, I am currently trying to connect n8n to my supabase stack. Everything is running in docker on ubuntu 24.04. Everything is on the same machine on separate docker containers. I'm not sure is permissions are the issue, but when I am point to a local host (127.0.0.1) I get connection refused. Same issue when connecting supabase, I know my credentials are correct, my username should be default. I am just wondering if there is a setting somewhere securing the port to inside it's own docker container network, and if so, how I can disable it? Thanks in advance.
21 Replies
What connection string are you using?
Are you self hosting using docker-compose?
@Sappireflames000 use Docker's internal network and connect using the service name (e.g., postgres instead of 127.0.0.1), and ensure the correct ports are exposed in your docker-compose.yml
Would this still be applicable even though they were in different stacks? I know each docker container has it's own network, I'm not sure if that network extends to other container networks. Though I am no expert on docker.
Yes, im self hosting using docker, Im using (host)= localhost (database)=postgres (user)=postgres (password)=(mypassword) and port 5432. My compose is pretty much default, but heres my auto-compose in a privatebin. https://privatebin.net/?eff72abeceaea4c6#VnxR4YjT9D5sX39EyWfzhhT62k4As6qjsBg8szKjfM2
I can't find any issue, but then again i've been using docker and linux for around 2 months now, so any expertise you can provide would be much appriciated.
PrivateBin
Encrypted note on PrivateBin
Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.
Are you using traefik proxy or using AI to fix some issue?
compose file is messed up
hold on, screwed that up
alright, messed up the auto-compose. traefik should be there now: https://privatebin.net/?bd6d584d432dc89c#FJg22t6gM2v9GeEG3eVYBXe5VYd6U3HeggsnpjvGsAct
PrivateBin
Encrypted note on PrivateBin
Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.
Are you on linux?
I assume you're on linux, which is the os I tested this on.


Do note that the user
postgres.your-tenant-id
, the value after .
comes from POOLER_TENANT_ID
env variable. By default it is your-tenant-id
Not sure whats going on here, Once I tried the bridge ip it kinda broke. It just infinitely trys to authenticate. I'm using a cloudflare tunnel for n8n, do you know if this could cause any issues? I can't imagine it would, but I suppose I could try installing n8n and supabase within the same container. Maybe I didn't install n8n correctly.
I glanced over your compose file, you're using some external networks. Are you running supabase in coolify?
You don't have to install supabase postgres and n8n in same container.
I'm running supabase cloned from github repo and n8n separately. n8n connects to supabase postgres via docker gateway (172.17.0.1)
No I'm not running it in coolify, my setup is fairly simple, just a ubuntu vm running 2 docker containers, n8n and supabase. Thats it. I can connect to the supabase dashboard on port 8000.
In your terminal, try to connect to db using psql.
You might have to install psql
This has to be run from your ubuntu vm
so I get connection refused again, I did change some variables in the .env file, Ill try to wipe those and use defaults to see it that works
I'd suggest create a fresh clone from supabase repo and then try. There is a lot of config in your compose file which isn't needed
Also make sure that your db password doesn't have any special characters, otherwise you'll have to escape them separately
you know what
i think that might be it
wait what do you mean by escaping them separately?
I meant encode
See the link
Try with a fresh repo without changing anything. copy the
.env.example
file and name it .env
, if that works then you will have a confirmation that there is something wrong with this setupalright, Ill try that in the morning, bit late for me, but regardless, thanks for your help thus far.