Description
Bug report
- I confirm this is a bug with Supabase, not with my own application.
- I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
When using supabase_client.functions.invoke("function-name")
and the edge-function return a custom error code like 403
with a body like {"error":"Unauthorized"}
, the raised exception override the status code to 400
, only the error message can be retrieved from the original server response.
In more details:
The function-py
sub-lib raise a FunctionsHttpError
here when the response is not 200
(as expected):
But the
FunctionsHttpError
have an hardcoded status code of 400
here:functions-py/supabase_functions/errors.py
Line 32 in 082653b
To Reproduce
Create an edge-function that return a custom error code and invoke it from supabase-py lib:
return new Response(JSON.stringify({error: "Unauthorized"}), {
status: 403,
headers: {"Content-Type": "application/json; charset=utf-8"}
});
Expected behavior
The FunctionsHttpError
exception should be configured with the real status code from the edge-function response.
Screenshots
System information
- Version of supabase-py: 2.13.0
- Version of supabase-edge-runtime: 1.67.0