https://supabase.com/ logo
Hey everyone, is there a way to call a `locally` h...
# help
n
Hey everyone, is there a way to call a
locally
hosted Edge Function inside a
PSQL Function
with the
pgsql-http
extension? I tried to POST the local Edge Function and I got *connection refused*:
"Failed to connect to localhost port 54321: Connection refused"
Database function extracted:
Copy code
BEGIN
  ...
  SELECT status FROM http_post('http://localhost:54321/functions/v1/<functionname>', ...);
  ...
END
Is there maybe a Docker alias of the Edge Function service?
n
Hello @NARCISO! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
s
The HTTP functions only really care about connecting to a URI, so yes, it's possible. localhost would point to the docker container that postgres is running in, not the system that docker is running on. You should either point it towards the IP (or domain) of the machine that the function is running on, or if the functions are also running inside a container, ensure both containers are connected to the same docker network, and add an alias name (e.g.
supabase-functions
) and use that as in your postgres function.
n
@Scott P Sorry for double posting it. I thought it was better to post it inside
sql
and then I forgot about this one.
Thank you for your very helpful explanation! I had troubles finding the docker container of the functions, but using the
host ip
is super fine for local development!
n
Thread was archived by @NARCISO. Anyone can send a message to unarchive it.