© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
1 reply
drewbie

Possible to hit localhost from db and+or edge functions?

I am trying to stick to a fully local development setup (locally) and am having troubles making requests to localhost from both a postgres function, or from an Edge Function. I know that both are ran via the Docker setup from the Supabase CLI, but I've tried about every combination of things I can try in order to make requests to localhost.

I've realized that localhost from the context of a Docker container, is just that container, not the machine's localhost. As an attempted work around for this, I've tried hitting the exposed Docker IP (in my case
172.25.145.178
172.25.145.178
) in the database functions and/or Edge functions, but that doesn't work. I've also added a URL to my hosts config locally so that the IP above can accept requests at a URL vs an IP (eg app.local -> 172.25.145.178) which exposes my Nextjs web app and search service to their corresponding ports at
app.local
app.local
, but that doesn't work in the database either.

I plan on storing the url's using Supabase Vault secrets, which will allow me to have different values for different Supabase environments (eg localhost:3000, staging.app.com, production.app.com etc) and reference those variables within my functions or Edge Functions. I just can't seem to get it wired up to my locally ran services. Any help would be appreciated.

Here's some example database functions

Tried localhost, that doesnt work since these services aren't ran from within the Supabase local Docker container
create trigger index_products_to_search
  after insert or update or delete on products
  for each row execute procedure 
  public.send_to_webhook( 'localhost:3000/api/test' );
create trigger index_products_to_search
  after insert or update or delete on products
  for each row execute procedure 
  public.send_to_webhook( 'localhost:3000/api/test' );


Tried adding a recoerd to hosts to listen at a URL vs localhost but no luck
create trigger index_products_to_search
  after insert or update or delete on products
  for each row execute procedure 
  public.send_to_webhook( 'http://app.local:3000/api/test' );
create trigger index_products_to_search
  after insert or update or delete on products
  for each row execute procedure 
  public.send_to_webhook( 'http://app.local:3000/api/test' );


Any help would be appreciated. Getting this nailed down would really help me get a great local dev setup going!
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Updating DB: Edge functions or RPC?
SupabaseSSupabase / help-and-questions
4mo ago
Call Edge Functions from Database Functions
SupabaseSSupabase / help-and-questions
7mo ago
Migrate from Legacy Edge Functions runtime to new Edge Functions Runtime
SupabaseSSupabase / help-and-questions
3mo ago
Sending Emails from Edge Functions
SupabaseSSupabase / help-and-questions
3y ago