FlutterFlow / flutterflow-issues

A community issue tracker for FlutterFlow.
125 stars 25 forks source link

Unable to unsubscribe or remove subscribed channels from Supabase realtime #3592

Closed czsday closed 3 weeks ago

czsday commented 3 months ago

Can we access your project?

Current Behavior

Currently, the realtime subscribe/unsubscribe does not work properly for me. I have read through all the available supabase/flutterflow documents and youtube videos regarding this. seems like a bug.

When subscribe to supabase realtime event, command with supabaseClient works for me (I am able to include API url, key and accessToken when initialize the subscribe instance). SupaFlow.client would not work (I have set RLS for realtime policy to public).

For unsubscribe code, I can't test with supa.flow because I am not able to subscribe with SupaFlow.client. By using supabaseClient with the same API url, key, accessToken, it does not unsubscribe. The wierd thing is if I append unsubscribe command to end of subscribe code, unsubscribe will work. if separate into two custom code actions (subscribe and unsubscribe), unsubscribe won't happen.

Expected Behavior

Since I have already set up supabase connections, SupaFlow.client should work for subscribe (supabase realtime policy set broadcast to public)

According to supabase doc, I should be able to kill all channels with supabaseClient.removeAllChannels(); But in flutterflow, it only remove channels when I append it to subscribe. I feel it probably couldn't find the corresponding channel if I add it into a separated custom action.

Steps to Reproduce

  1. Test mode, sign in with test3@gmail.com password is 000000, load "messages" page
  2. run API calls named loginAPI (test API Call with variables email: test4@test.com, password: 0000), then copy the access token from Test Response.
  3. go to newMessageAPI, and paste accessToken into variables and enter anything in the message_text variable, then click Test API call
  4. In Test mode "messages" page, if you see the new message, that meams the custom code "unsubscribe" did not work.
  5. In Action Flow Editor in "messages" page, if you switch Custom Action subscribe to subscribeSupaFlow and unsubscribe to unsubscribeSupaFlow.
  6. set action arguments table to message, accessToken to App State accessToken, callbackAction to ShowSnackBar
  7. repeat step 1~4, you will see the ShowSnackBar never happen, because Custom Action subscribeSupaFlow would not work.

Reproducible from Blank

Bug Report Code (Required)

ITFfkvLluYtPxd9Y0a6JaPlKp2EUOVMcTL4zlO1HcxAYGO/yPbJ/ZcneZVtCXcO5SmlhHFb/rzoHw/z2j/DhC/UFBweBQa46/pFtEg7JVXq8SoyrBau0bXNAL+RRFWqg5LerviVRBMpedF4EwEyqJuu9VhLACZu/Zwh9f6PHaOI=

Visual documentation

subscribe (works): subscribe

unsubscribe (2 methods, doesn't work): image

works if append unsubscribe to subscribe (combine into one custom action): image

subscribeSupaFlow (subscribe does not work even with supabase integrated in Flutterflow) image image

unsubscribeSupaFlow (don't know if it works or not because not able to subscribeSupaFlow) image

Supabase realtime policies open to public for select and insert: image

Environment

- FlutterFlow version: v4.1.81+
- Platform: Windows
- Browser name and version:Chrome v127.0.6533.90
- Operating system and version affected: Windows 10

Additional Information

No response

github-actions[bot] commented 2 months ago

This issue is stale because it has been open for 7 days with no activity. If there are no further updates, a team member will close the issue.

Alezanello commented 1 month ago

Hello,

I apologize for the late response. Does this issue still persist, or was it fixed in the latest FlutterFlow updates?

Alezanello commented 3 weeks ago

Closing this issue since we haven't heard back from you. If you are still facing the problem please submit a new issue. Have a great day!