From ab794c08579c29f6a67cdce2f26609e340d4b694 Mon Sep 17 00:00:00 2001 From: Alex Currie-Clark <1306728+acurrieclark@users.noreply.github.com> Date: Fri, 30 Sep 2022 10:12:44 +0100 Subject: [PATCH] Note for accessing services across docker containers I spent a few hours today trying to work out why I couldn't connect to my local Supabase DB from a local Supabase function. It dawned on me that the `SUPABASE_DB_URL` included the `localhost` string, which would attempt to connect to the DB on the same container as the functions are hosted. Swapping out `localhost` for `host.docker.internal` fixed the issue. Thought it would be worth documenting. Happy to amend or move to a more appropriate place if needs be. --- apps/reference/docs/guides/cli/local-development.mdx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/reference/docs/guides/cli/local-development.mdx b/apps/reference/docs/guides/cli/local-development.mdx index aade041eaa5..c82825750c6 100644 --- a/apps/reference/docs/guides/cli/local-development.mdx +++ b/apps/reference/docs/guides/cli/local-development.mdx @@ -107,6 +107,10 @@ http://localhost:54321/auth/v1/ # Auth (GoTrue) +:::note +If you are looking to access, for example, your database from an edge function within your local Supabase setup, you will need to replace `localhost` with `host.docker.internal` in any URLs. +::: + ## Database migrations Database changes are managed through "migrations." Database migrations are a common way of tracking changes to your database over time.