flutterflow call api to supabase edge function fail in web published mode - Pls help. Tearing at my hair - and I have little left.

Database & APIs

Flutterflow api call to edge function works in test mode but not in web published mode (domain held at Flutterflow).

The error message revealed on clicking the console errors was {"code":401,"message":"Missing authorization header"}

The supabase table which was supposed to be updated by the edge function with a new public key was not updated - (the old public key remained)

What have you tried so far?

I have looked through several community discussions, and also used methods from chatgpt, and flutterflow documents

in the api call configuration I have tried Authorization: Bearer [auth_token], and also tried with <auth_token> and ${auth_token} - --- (the [auth-token] format worked in test mode, otherwise all else failed in test and web published modes)

I have also updated auth_token using an app state variable (named token which has been updated by auth.user's jwt). I have also tried directly linking auth_token to auth.user's jwt token in the argument part of the api call action block. (worked in test mode only, but failed in published web mode)

I have used Postman to test the edge function url with Authorization bearer token - it works.

I have made sure that the page variable - token is properly updated in the api call by displaying the jwt token in one of the textfields as soon as the token is updated.

I also tried to add apikey to the header (ie. the anon key) - worked in test mode using apikey: <myapikey>, failed in web mode. apikey: [myapikey] failed in both test and web published modes.

other custom action dealing with supabase worked ok but not edge functions

Did you check FlutterFlow's Documentation for this topic?
Yes
2
2 replies