Realtime not working with RLS

Hello! I am trying to listen for changes in realtime on a table called folders, on which I have a few simple policies:
create policy "Users can create folders" on folders
  for insert with check (auth.uid() = user_id);

create policy "Users can view their own folders" on folders
  for select using (auth.uid() = user_id);

create policy "Users can update their own folders" on folders
  for update using (auth.uid() = user_id);

create policy "Users can delete their own folders" on folders
  for delete using (auth.uid() = user_id);

So I created a subscription like so:
const subscription = client.from("folders").on("*", (payload) => {
  console.log(payload)
}).subscribe()

The websocket connection is created successfully, however when I INSERT or UPDATE some folders, it wasn't receiving any message (except a few times, randomly, I didn't figure out why). Yet, it was receiving the DELETE messages.
So I disabled RLS on folders table, and now it was working perfectly.

Project ID: hgqnfohuvgxsdcoymawt

I really don't have any idea on how to fix this, so I would really appreciate your help!
Was this page helpful?