-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
supabase.functions.invoke returns null data when response is non-2xxx #45
Comments
This and #55 are pretty much duplicates, I explained in the other Issue why its happening. In this specific issue, the client checks if any errors happened during the fetch, if it has a RelayError, or if the response did not return a 2xx response. If any of these happen, the client will directly skip the data response and only return the error thrown internally inside the client, not the error causing throw: functions-js/src/FunctionsClient.ts Lines 115 to 117 in af4113a
That said, the functions-js/src/FunctionsClient.ts Lines 80 to 99 in af4113a
Depending on the source, you'll get the response or the fetch error. |
Perhaps relevant, when testing error states using Deno test, if you don't
|
Still happening is there any live solution or we still waiting for official fix? |
+1 on this issue. Its making it difficult to debug things in production as our sentry errors just show |
+1 |
4 similar comments
+1 |
+1 |
+1 |
+1 |
This is baffling. I am also getting this response but I know from the function code that is definitely intending to return a 200 status. |
+1 |
+! |
+1 |
I debugged using the error handling code snippet below. Turns out I did not have the right authentication for my edge function. I added the secret key for my new edge function. Hope this helps!
|
+1 im using a rate limit and I send a 429 response and we again "FunctionsHttpError: Edge Function returned a non-2xx status" we cannot even pull the status code since error.code provides an undefined value. |
If anyone comes here and just want to show the error, this was my solution:
|
Note that if you return your error messages in |
Bug report
Describe the bug
When calling
supabase.functions.invoke
to a function that responds with non-2xx status code following error is returned with null data:Supabase gives full freedom on how Edge Functions are implemented without enforcing any schema. However,
supabase-js
is enforcing some response schema because it discards response body when status is non-2xx.To Reproduce
data
is null.Expected behavior
data
is available when Edge Functions responds with non-2xx response.The text was updated successfully, but these errors were encountered: