2

I am using Supabase as my BaaS, and i have developed and deployed multiple Edge functions. Now i am attempting to develop and debug them locally. However, i am having some issues.

As described here https://supabase.com/docs/guides/functions/local-development i have pulled all the images and ran the supabase stack. Then i served my function. This went smoothly. However, when i try to do any HTTP requests, i get the following error: error sending request for url (http://localhost:8000/users): error trying to connect: tcp connect error: Cannot assign requested address (os error 99)

Anyone who can help with this? I would assume it is a docker-related issue which i dont have much experience with other than trying to expose the ports.

enter image description here

Serving the hello-world function works fine:

% curl --request POST 'http://localhost:54321/functions/v1/hello-world' \ --header 'Authorization: Bearer <anon key>' \ --header 'Content-Type: application/json' \ --data '{ "name":"Functions" }' {"message":"Hello Functions!"}%

SOLVED

Seems like the error shown above appeared because the function did not deploy properly. It showed an error when deploying so it basically were unavailable. Fixing the error resolved the issue.

  • Please [edit] your question and add the **code, logs, output, error messages... in the question body as code blocks**. Using images for this has [numerous disadvantages](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-errors-when-asking-a-question/285557#285557) and is specifically listed as a bad practice in [ask]. Thanks – Zeitounator Feb 11 '23 at 16:22
  • 1
    If you use Supabase CLI to run your function locally, your URL is going to look something like `http://localhost:54321/functions/v1/hello-world`, but where did you get `localhost:8000`? – dshukertjr Feb 13 '23 at 05:54
  • @dshukertjr wondering the same thing. I made the HTTP request in the format you described, `(http://localhost:54321/functions/v1/users)` in my case) and I get the response I posted above. – Adrian Brenne Feb 13 '23 at 08:34
  • @AdrianBrenne How are you invoking the function? Can you try the curl command here and see if you succeed? If you get an error, could you copy and paste it on your question? https://supabase.com/docs/guides/functions/local-development#invoking-edge-functions-locally – dshukertjr Feb 13 '23 at 09:18

0 Answers0