Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RealtimeClient not working while RLS is enabled, but SupabaseClient can access data while RLS is enabled. #19

Open
sazidbs23 opened this issue Jul 17, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@sazidbs23
Copy link

Bug report

Describe the bug

After connecting to RealtimeClient and subscribing to channel everything works fine while RLS is disabled, i.e. getting any event(insert, delete, update) from corresponding table.

But whenever RLS is enabled i'm not getting any event on channel subscription for desired database table. FYI I can access data(read, insert, delete, update) from that desired table after RLS is enabled. Only problem is didn't receiving any event in RealtimeClient subscription while RLS is enabled.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Make a channel subscription:
        let userChanges = realtimeClient.channel(.table("table-name", schema: "public"))

        userChanges.on(.insert) { message in
            print("### insert message ###")
        }
        userChanges.on(.delete) { message in
            print("### delete message ###")
        }
        userChanges.on(.update) { message in
            print("### update message ###")
        }

        userChanges.subscribe()
  1. Disable RLS in table table-name.
  2. Get the result properly.
  3. Enable RLS in table table-name.
  4. You will not get any event or update from the channel.
  5. But you can access data from table-name with corresponding RLS is enabled.

Expected behavior

As I can access data from desired table with RLS enabled it is expected to get RealtimeClient update also while RLS is enabled.

System information

  • OS: [iOS 16.2]
  • Version of supabase-realtime: [0.0.2]
  • Version of supabase-swift: [0.2.1]
@sazidbs23 sazidbs23 added the bug Something isn't working label Jul 17, 2023
@vilimas
Copy link

vilimas commented Aug 8, 2023

#15 (comment)

This is the answer if somebody is having the same problem. I think docs should mention this use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants