← All errors · LovableServerless & Edge Function errors
Edge Function returned a non-2xx status code
Exact error
FunctionsHttpError: Edge Function returned a non-2xx status code
What it means
supabase.functions.invoke() reached your Supabase Edge Function, but the function responded with an error status. The real error is in the function's logs or response body.
Likely causes
- An exception inside the function (often a missing secret such as an API key).
- Function returns 4xx/5xx for invalid input.
- Missing Authorization header when JWT verification is on.
How to fix it
Open Supabase Dashboard → Edge Functions → your function → Logs to see the actual exception.
Read the response body on the client:
const { data, error } = await supabase.functions.invoke('my-fn', { body: { x: 1 } }); if (error && error.context) { console.error(await error.context.text()); }Set missing secrets:
supabase secrets set OPENAI_API_KEY=...
Prevent this next time
- Add timeouts to outbound requests and return clear error responses instead of crashing.
- Set up uptime checks and log alerts on critical endpoints so you hear about failures before users do.
Guide: catch outages before your users do.
FAQ
What does "Edge Function returned a non-2xx status code" mean?
supabase.functions.invoke() reached your Supabase Edge Function, but the function responded with an error status. The real error is in the function's logs or response body.
What usually causes it?
An exception inside the function (often a missing secret such as an API key). Function returns 4xx/5xx for invalid input. Missing Authorization header when JWT verification is on.
How do I fix it?
1. Open Supabase Dashboard → Edge Functions → your function → Logs to see the actual exception. 2. Read the response body on the client: 3. Set missing secrets:
Related errors
Get new fixes weekly
No spam. Unsubscribe anytime. Privacy