How to set up supabase local API in V2 Supabase RAG AI Agent?

Hello,

I’m trying to configure V2 Supabase RAG AI Agent following the Run Supabase 100% LOCALLY for Your AI Agents video ( https://youtu.be/pOsO40HSbOo ).

I’m stuck on Delete Old Doc Rows which requires the correct host for Supabase API.

I’ve tried :

But I still get the error message “Couldn’t connect with these settings” “Couldn’t connect with these settings
ECONNREFUSED”

What are the possible errors?
a) I’m entering the wrong url. Supabase is installed via docker via local-ai-packaged. What credential do you use for “Delete Old Doc Rows”?

b) I’ve entered the wrong Service Role Secret? I took what I had put in .env for SERVICE_ROLE_KEY

c) My supabase isn’t ready: I’ve just logged in, but haven’t done anything on it yet. Maybe the first tables need to be created, I don’t know. I wonder how well it works. If, for example, I go to API Docs I get this message: “Something went wrong :face_with_head_bandage:
Sorry about that, please try again later or feel free to reach out to us if the problem persists.”

Does anyone have any ideas on how to solve this problem?

Thanks a lot !

1 Like

Try http://kong:8000

kong is the name of the dashboard service in the Supabase Docker Compose stack, so you want to use that name to communicate with the container directly!

If that doesn’t work I’d check to see if there are any containers for Supabase that aren’t running or are constantly restarting.

1 Like

Thank you very much for your reply.

I have tried the following:
http://kong:8000
http://supabase-kong:8000 (as shown in this video https://youtu.be/Vwy9rrXaz_E )

But It couldn’t connect.

Yes, you’re right, there are containers for Supabase that restart constantly:
supabase/storage-api:v1.19.3 “docker-entrypoint.s…” 2 days ago Restarting (1) 24 seconds ago
supabase/storage-api:v1.19.3 “docker-entrypoint.s…” 2 days ago Restarting (1) 24 seconds ago supabase-storage
supabase/postgres-meta:v0.86.1 “docker-entrypoint.s…” 2 days ago Up 3 hours (healthy) supabase-meta
supabase/studio:20250224-d10db0f “docker-entrypoint.s…” 2 days ago Up 3 hours (healthy) supabase-studio
kong:2.8.1 “bash -c 'eval "echo…” 2 days ago Up 3 hours (healthy) supabase-kong
supabase/supavisor:2.4.12 “/usr/bin/tini -s -g…” 2 days ago Restarting (1) 3 seconds ago supabase-pooler
supabase/realtime:v2.34.40 “/usr/bin/tini -s -g…” 2 days ago Up 3 hours (healthy) realtime-dev.supabase-realtime
supabase/gotrue:v2.170.0 “auth” 2 days ago Restarting (2) 24 seconds ago supabase-auth
supabase/edge-runtime:v1.67.2 “edge-runtime start …” 2 days ago Up 3 hours supabase-edge-functions

I’ll try to investigate this.

This may be due to passwords containing incorrect characters %, ?, "… I’ll try to make a clean new installation of the local ai package with cleaner passwords.

Yes, it was due to passwords containing incorrect characters %, ?, "

I tried to change them but without success. So I deleted everything and started form scatch with a new configuration.

And it works with both urls:

http://kong:8000

http://supabase-kong:8000

I don’t know if it’s the same thing or if it’s better to choose kong or supabase-kong but it works :slight_smile: Let’s follow with the video https://youtu.be/Vwy9rrXaz_E

2 Likes

Both are ok, thats cause of the docker-compose of supabase:

The default would be “kong” but we gave it another one to with container_name attribute, which is supabase-kong.

2 Likes

Ok thanks a lot for your reply :slight_smile:

1 Like

I’ve tried both http://kong:8000 and http://supabase-kong:8000 with no connection. Also, my supabase-kong Docker container shows TWO active ports - 8000 and 8443. The 8443 port displays “400 Bad Request. The plain HTTP request was sent to HTTPS port”

Hello,

First, check if there are any containers for Supabase that aren’t running or are constantly restarting.

If yes, have you checked your passwords in.env ? Maybe there is special characters ( % à è ? "…) ?

I’ve tried everything to get my Supabase credentials to work in n8n and nothing works. Every little detail seems to be correct. Now I want to start over and reinstall the Supabase components of the Local AI Package. Can I just follow this YouTube video by DIY Smart Code, or are there other installation considerations to make Supabase work with the rest of the Local AI Package?

@jturnure if you start with a fresh/clean system, no other supabase containers etc. you need to use, then you can just use the full local-ai-package instead of the guide from my video you posted above.

By default local-ai has the supabase as subproject included and starts it up. You can watch this video instead:

Thanks! I followed that video for my original install. Are you suggesting I do a complete reinstall of the full local-ai-package? If so, what happens to all my n8n workflows and credentials, OpenWebUI stuff, data in Qdrant, etc.? I don’t want to lose everything that is working well.

If you did it as described in the video, its strange that it is not working.
What is the actual error you get and are all the docker containers for supabase up and running? Also => before you started the local-ai, there was no supabase containers already there, right?

My docker containers for Supabase are all runing and healthy: supabase-storage (no port assignment), supabase-kong (port 8000:8000), supabase-analytics (port 4000:4000), supabase-db (no port assignment), and supabase-imgproxy (no port assignment).
My n8n Supase credentials are: http://supabase-kong:8000 and Service role secret copied exactly from .env file and verified in the docker container env.
Exact error is: Couldn’t connect with these settings. Service Temporarily Unavailable

hm ok, dont see the problem by these infos. Can you paste some screenshots of your docker environment and n8n and also append the logs as txt file here (n8n container and supabase-kong)


Supabase-kong container log.json (481.0 KB)
n8n container log.json (140.8 KB)

I see a lot of DNS errors, which does not appear for me in my log for instance.
What exactly did you change from the default configuration the local-ai-package provided?

I didn’t make any changes. That’s what’s so puzzling.

Since I can’t figure out how to fix the cureent problem, is it viable to disable or delete the Supabase Docker containers under the local-ai-package project and then compose new Docker containers for Supabase outside the local-ai-package?