-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't send HTTP requests to localhost from a trigger function #79
Comments
Hm, this looks more of an infra issue since pg_net is reporting the error correctly. This seems related supabase/supabase#9837 @HTMHell Could you try reaching your edge function with pgsql-http? |
Yep, this is unfortunately due to @HTMHell could you try using any of the above options to confirm that the http request connects as expected? |
Yup, that did the trick. Thank you! |
It doesn't look like a Supabase edge function, so I don't think it applies to you. |
I'm trying to reach out to a nuxt instance being run on |
In that case, you're using the wrong hostname |
@chang-ryan did you manage to get it working. I'm stuck at the same problem. @HTMHell you're saying host.docker.internal is the wrong hostname. But what would be the right one. I've been trying many different ones (host.docker.internal, the ip address of my machine, 172.17.0.1, localhost, 127.0.0.1) In my understanding host.docker.internal should be the right one, but it simply refuses to work. The weird thing is I can rerach the dashboard at 54323 but no other service running under localhost |
To my understanding, you should use that hostname if you're using an edge function (or any other service in the same Docker container). If you're running a server on your machine, since postgres is running in docker, which is a different machine, I'd assume you'll need to use your computer's local IP address. |
@HTMHell thank you for your reply! I think th eissue is the netowrking mode, which is not set to host for the db container, but this is a cli issue rather than a pg_net issue, so I opened an issue there |
@chang-ryan Did you resolve the issue? I'm running into the same issue on my Ubuntu box with supabase Any hints on how to debug this further would be very much appreciated. |
@unidesigner a quick Google search told me that host.docker.internal is only for macos (and maybe windows?). So something else should work: https://stackoverflow.com/questions/48546124/what-is-the-linux-equivalent-of-host-docker-internal#48547074 |
This was necessary for me to make calls with the supabase client from an edge function after getting a very general connection refused error. After a decent amount of digging this was the only place I've seen this documented. Would be helpful to have a blurb about this somewhere in the docs - either in the local dev section or the edge functions section. |
Thanks @supermar1010 for the feedback. Unfortunately, I cannot make it work with all the suggestions in the SO article. I tried |
@unidesigner did you find a better solution than tunneling for Linux? |
@davidfant Unfortunately not yet. |
Bug report
Describe the bug
When trying to send a request from a trigger function, the request doesn't reach the server. In the
_http_response
table, the error message is:To Reproduce
Do the following locally:
Expected behavior
The request should go through.
Additional context
curl
my edge function, it worksSystem information
The text was updated successfully, but these errors were encountered: