How postgres_changes decides what you get
Realtime reads changes from Postgres logical replication, but only for tables in the supabase_realtime publication. For each change it checks whether this subscriber may see the row, using the subscriber's JWT and your RLS policies, then applies your filter. If any step says no, the event is dropped silently. No error is raised, which is why this is confusing.
1. The table is not in the publication
select schemaname, tablename
from pg_publication_tables
where pubname = 'supabase_realtime';
alter publication supabase_realtime add table public.messages;The dashboard toggle “Enable Realtime” on the table does the same thing.
2. RLS or grants hide the row from the subscriber
With RLS on, the subscriber needs a SELECT policy that matches the row, exactly as if they ran select themselves. Signed-out subscribers run as anon, so a policy to authenticated never matches them. Subscribe after sign-in; if you manage tokens yourself, pass the token with supabase.realtime.setAuth(token). The role also needs a SELECT grant on the table, which new tables no longer get automatically.
grant select on table public.messages to authenticated;
create policy "members read room messages" on public.messages
for select to authenticated
using (room_id in (select private.my_room_ids()));Test it simply: if this user can't select the row through the API, Realtime won't send it either.
3. The filter doesn't match
Filters are column=operator.value expressions, such as room_id=eq.42 or name=in.(red,blue), evaluated on the server. Check the operator against the “Available filters” table in Supabase's Postgres Changes docs, since older client and server versions support fewer of them. A typo in the column name or a value of the wrong type gives no events and no error. Event names are upper case: 'INSERT', 'UPDATE', 'DELETE' or '*'.
4. UPDATE and DELETE look empty
By default payload.old holds only the primary key. To get the previous values, and to be able to filter DELETE events, set the replica identity to full:
alter table public.messages replica identity full;Also note: RLS policies are not applied to DELETE events, which is why their payload carries so little.
5. You never look at the subscribe status
Log the status callback. CHANNEL_ERROR and TIMED_OUT mean the subscription itself failed (often an expired token or a bad filter), which is a different problem from events being filtered out:
const channel = supabase
.channel('room-42')
.on(
'postgres_changes',
{ event: 'INSERT', schema: 'public', table: 'messages', filter: 'room_id=eq.42' },
(payload) => console.log('new message', payload.new),
)
.subscribe((status, err) => {
console.log('realtime status', status, err); // SUBSCRIBED, CHANNEL_ERROR, TIMED_OUT, CLOSED
});
// when the component unmounts
supabase.removeChannel(channel);How to verify
Keep the page open with the console visible, then insert a row from the SQL Editor that the signed-in user is allowed to read:
insert into public.messages (room_id, body, user_id)
values (42, 'realtime test', '<the-subscribers-user-uuid>');The callback should fire within a second or two. If it fires for a using (true) test policy but not for your real one, the policy is the problem. For high-volume tables, Supabase suggests Broadcast instead, because every change is checked against RLS once per subscriber.
Related guides
- Supabase “permission denied for table” – a missing GRANT, not a missing policy
- Supabase “infinite recursion detected in policy for relation” – cause and fix
- Supabase auth.uid() returns null – where it works, where it can't, and how to test policies
- Supabase “new row violates row-level security policy” – causes and fix
More in Supabase RLS and Storage · all guides