© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
94 replies
Pierre_

Realtime not working with RLS

Hello! I am trying to listen for changes in realtime on a table called
folders
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);
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()
const subscription = client.from("folders").on("*", (payload) => {
  console.log(payload)
}).subscribe()

The websocket connection is created successfully, however when I
INSERT
INSERT
or
UPDATE
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
DELETE
messages.
So I disabled RLS on
folders
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!
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Realtime RLS not working with anon user
SupabaseSSupabase / help-and-questions
3y ago
(solved) Realtime subscriptions not working with RLS?
SupabaseSSupabase / help-and-questions
4y ago
Realtime not working with Custom Jwt with RLS
SupabaseSSupabase / help-and-questions
3mo ago
Realtime RLS problem
SupabaseSSupabase / help-and-questions
2mo ago
Next page