Supabase Authorization failed - when connecting to n8n

I have busabase and n8n running on a local machine within docker compose files, both containers can communicate with eachother, they are on the correct bridge, and I have the correct host, but it always says my credentials are incorrect. I checked the .env file and it is 100% correct, is there a known bug about this? I don't see any reason why it would give an authentication error. Any help would be much appreciated.
39 Replies
inder
inder2w ago
Sappireflames000
Sappireflames000OP2w ago
So connecting to postgres is done, I figured out that each container was on a different bridge, but now I am having a problem with connecting the supabase vector store to n8n, with the service role secret, and the host name. I know both are correct, but it keeps giving bad authentication error. I've tried connecting to the vector store using curl as well, same issue, invalid credentials. Is there a specific format the anon key or service role key? nvm, I got it working. Found this on reddit, you need to add dashboard credentials inside the hostname: "You must add the basic auth credentials in the url and use local domain name of docker (FQDN). http://[USER DASHBOARD]:[PASSWORD DASHBOARD]@[LOCAL DOMAIN]:8000"
inder
inder2w ago
This is a specific thing about http basic auth as kong has enabled it by default
inder
inder2w ago
The workaround you've found is about making a http request to the dashboard itself. This isn't needed
No description
inder
inder2w ago
No description
Sappireflames000
Sappireflames000OP2w ago
Interesting, are there any downsides to using the dashboard?
inder
inder2w ago
Internally, n8n is making a request to the rest api. This is why they ask for service_role secret. In your route, you make a request to port 8000, this is the port kong is serving on so it is forwarding this request to postgrest service And the downside is that you expose the dashboard password in plain text Now that's fine if its just a test instance
Sappireflames000
Sappireflames000OP2w ago
okay, do you know where I can turn off basic http authentication? Using that method seems to be the only way I can actually connect to the vector store
inder
inder2w ago
In volumes/api/kong.yml file, comment out lines 239-241 and then recreate containers
No description
inder
inder2w ago
Have you customized the setup in any way? Because I'm running the supabase cloned from github repo and I didn't need to use dashboard password in connection string
Sappireflames000
Sappireflames000OP2w ago
The only thing I have changes was mounting an iscsi drive to /volumes/storage. Though I'm not sure why this would cause any changes to auth properties.
inder
inder2w ago
It shouldn't
Sappireflames000
Sappireflames000OP2w ago
What OS are you running with supabase? I'm using ubuntu 24.02, But I'm running complete fresh installs of supabase and n8n and I cannot connect without URL credentials, but then N8N also gives errors inside workflows, not allowing me to use credentials within the URL. so im kinda stuck here. Maybe ubuntu just doesn't work for this type of thing?
inder
inder2w ago
ubuntu 24.04 on ec2
Sappireflames000
Sappireflames000OP2w ago
Well, then. I'm out of ideas. This is the weirdest issue.
inder
inder2w ago
Do you use the same host as I do? 172.17.0.1
Sappireflames000
Sappireflames000OP2w ago
I use 172.19.0.1 It definitely is connecting to the right server, it just gives an AUTH error, saying credentials are incorrect. Unless I add URL credentials
inder
inder2w ago
Let me test with the container's subnet. 172.17.0.1 is docker gateway
Sappireflames000
Sappireflames000OP2w ago
This might be a stupid question, but if it needs the dashboard user and password, is there a way to fit that into the service role secret area?
inder
inder2w ago
My gateway is 172.18.0.1, but works without using any creds
No description
inder
inder2w ago
What do you mean? I didn't understand What command did you run to get this stack's gateway address?
Sappireflames000
Sappireflames000OP2w ago
Well I used docker ps to find the container ID for kong and n8n when docker inspect to get the gateway then
inder
inder2w ago
Run docker network ls and there must be a supabase network in there. Copy the network id of this network and run this command
docker network inspect <NETWORK_ID> | jq .[].IPAM.Config.[].Gateway
docker network inspect <NETWORK_ID> | jq .[].IPAM.Config.[].Gateway
Sappireflames000
Sappireflames000OP2w ago
yup, came back with 172.19.0.1
inder
inder2w ago
Have you tried on a different server? Maybe you messed around with some config and forgot to set it back? For supabase, I simply cloned the repo from github and ran n8n with the command mentioned in their github repo's readme And supabase containers and n8n container are running in different networks
Sappireflames000
Sappireflames000OP2w ago
they are running in different containers, But I added the supabase_default network to the n8n docker compose file
inder
inder2w ago
I simply run this command. I'm passing SECURE_COOKIE=false env variable as I'm serving it on http (not on localhost)
docker volume create n8n_data

docker run -d -e N8N_SECURE_COOKIE=false --name n8n -p 5678:5678 -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n
docker volume create n8n_data

docker run -d -e N8N_SECURE_COOKIE=false --name n8n -p 5678:5678 -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n
Sappireflames000
Sappireflames000OP2w ago
Yeah, I have another vm i used a simular command to run another n8n instance, same issue. so, I'm not sure. Ill try to wipe the whole VM and start from scratch. Ill try running them all in the same stack this time. Hopefully that will change things.
inder
inder2w ago
If you run in the same stack, then you can use service name for dns resolution As you say you added supabase_default network in n8n compose file, you could've used service name in this case as well Share the compose file of n8n
Sappireflames000
Sappireflames000OP2w ago
here is the compose file, i also used another n8n instance from another vm to try and use the ipv4 address of the machine, it connects like before (if I use URL credentials): services: traefik: image: "traefik" restart: always command: - "--api.insecure=true" - "--providers.docker=true" - "--providers.docker.exposedbydefault=false" - "--entrypoints.web.address=:80" - "--entrypoints.web.http.redirections.entryPoint.to=websecure" - "--entrypoints.web.http.redirections.entrypoint.scheme=https" - "--entrypoints.websecure.address=:443" - "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true" - "--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}" - "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json" ports: - "80:80" - "443:443" volumes: - traefik_data:/letsencrypt - /var/run/docker.sock:/var/run/docker.sock:ro networks: - supabase_default # Ensure Traefik also connects to this network n8n: image: docker.n8n.io/n8nio/n8n restart: always ports: - "5678:5678" labels: - traefik.enable=true - traefik.http.routers.n8n.rule=Host(${SUBDOMAIN}.${DOMAIN_NAME}) - traefik.http.routers.n8n.tls=true - traefik.http.routers.n8n.entrypoints=web,websecure - traefik.http.routers.n8n.tls.certresolver=mytlschallenge - traefik.http.middlewares.n8n.headers.SSLRedirect=true - traefik.http.middlewares.n8n.headers.STSSeconds=315360000 - traefik.http.middlewares.n8n.headers.browserXSSFilter=true - traefik.http.middlewares.n8n.headers.contentTypeNosniff=true - traefik.http.middlewares.n8n.headers.forceSTSHeader=true - traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME} - traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true - traefik.http.middlewares.n8n.headers.STSPreload=true - traefik.http.routers.n8n.middlewares=n8n@docker environment: - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME} - N8N_PORT=5678 - N8N_PROTOCOL=https - NODE_ENV=production - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/ - GENERIC_TIMEZONE=${GENERIC_TIMEZONE} - N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true volumes: - n8n_data:/home/node/.n8n - ./local-files:/files networks: - supabase_default volumes: n8n_data: traefik_data: networks: supabase_default: external: true
inder
inder2w ago
Can you wrap it in codeblock? Its hard to understand what's going on here.
Sappireflames000
Sappireflames000OP2w ago
PrivateBin
Encrypted note on PrivateBin
Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.
inder
inder2w ago
Ya, if the containers are in the same network you can directly use the service name instead of ip address
No description
inder
inder2w ago
And this is the compose file. I glanced over your compose file, are you using AI to generate the file? There are fields which aren't needed like entrypoint doesn't need to be overriden
services:
n8n:
image: docker.n8n.io/n8nio/n8n
ports:
- 5678:5678
volumes:
- n8n_data:/home/node/.n8n
networks:
- supabase_default
environment:
- N8N_SECURE_COOKIE=false


volumes:
n8n_data:

networks:
supabase_default:
external: true
services:
n8n:
image: docker.n8n.io/n8nio/n8n
ports:
- 5678:5678
volumes:
- n8n_data:/home/node/.n8n
networks:
- supabase_default
environment:
- N8N_SECURE_COOKIE=false


volumes:
n8n_data:

networks:
supabase_default:
external: true
Sappireflames000
Sappireflames000OP2w ago
No I didn't use AI, I don't remember where I got the n8b compose, but the supabase compose was from the supabase official website But after some research I got both supabase and n8n in the same stack this worked I don't know why it wasn't working before but I spun up a new vm, with a new docker stack, and it is working now
inder
inder2w ago
Could be some config you changed or missed before. Glad that you got it working. If the services are in the same network, then better to use service name directly for DNS
Sappireflames000
Sappireflames000OP2w ago
yeah thats how I have it configured. I got http://kong:8000
inder
inder2w ago
Also you can remove the entrypoint config from compose file for n8n. Its only used if you want to override the default entrypoint of the image
Sappireflames000
Sappireflames000OP2w ago
Sounds good, thanks for your help!

Did you find this page helpful?