This repository was archived by the owner on Aug 22, 2025. It is now read-only.

Description
Bug report
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):
|
raise FunctionsHttpError( |
But the
FunctionsHttpError have an hardcoded status code of
400 here:
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