"Read Supabase Edge Function Error Responses in Flutter"

How to read a Supabase edge function error response in Flutter: catch FunctionException, inspect status and the real error body, then fix 401/500 errors.

You call functions.invoke , and instead of the data you expect, you get Edge Function returned a non-2xx status code . That&#x27;s it — no message, no hint about what went wrong on the server. If you&#x27;re wondering how to read supabase edge function error response flutter, the short answer is: catch FunctionException and read status and details . The real error message is sitting right there in the response body, and the Dart SDK hands it to you — if you know where to look. This guide shows you exactly where to find it: how to catch FunctionException , pull the HTTP status and the decoded error body out of it, map common failures (401 unauthorized, 500 server errors, CORS errors that are actually something else), and build a small repository-layer pattern so your app surfaces real error messages instead of generic crashes. *Last updated: October 3, 2026* What you&#x27;ll learn How to read a Supabase edge function error response in Flutter from FunctionException Why "Edge Function returned a non-2xx status code" appears and what the real error is Fixing 401 unauthorized (verify_jwt, expired or missing tokens) Fixing 500 errors by reading the actual function crash from the response body Why a "CORS error" is usually a 401 or 500 in disguise A typed-error repository pattern for functions.invoke calls The problem: the SDK hides the real error When you invoke an edge function with a non-2xx result, supabase_flutter throws a FunctionException . The message is deliberately terse: // lib/main.dart import &#x27;package:flutter/material.dart&#x27;; import &#x27;package:supabase_flutter/supabase_flutter.dart&#x27;; Future<void> main() async { WidgetsFlutterBinding.ensureInitialized(); await Supabase.initialize( url: &#x27;https://xyzcompany.supabase.co&#x27;, anonKey:…

Explore