Fix guide · updated 2026-11-17
Supabase Realtime postgres_changes not working: SUBSCRIBED but no events (the real causes, tested)
SUBSCRIBED but no events · Unable to subscribe to changes with given parameters · Error parsing `filter` params · cannot add `postgres_changes` callbacks after `subscribe()`
Your channel says SUBSCRIBED, a row changes in the database, and your postgres_changes callback never runs. Nothing looks wrong because the subscribe callback only tells you that the channel joined. Whether Realtime can actually watch your table comes a moment later, in a separate system message that most apps never listen to. Add one listener, read that message, and match it to the sections below. We ran every case on Supabase Realtime v2.167.0 (the version the Supabase CLI runs) with supabase-js 2.119, in November 2026.
1. Make the hidden message visible
Add a system listener next to your postgres_changes one, and log both arguments of the subscribe callback:
const channel = supabase
.channel('todos-feed')
.on('system', {}, (msg) => console.log('realtime system:', msg))
.on('postgres_changes', { event: '*', schema: 'public', table: 'todos' }, (payload) => console.log(payload))
.subscribe((status, err) => console.log('status:', status, err))
Reload the page and look at the browser console. In our tests, the subscribe callback said SUBSCRIBED in every case of this page, even the broken ones. The system message is what tells them apart:
status: 'ok',message: 'Subscribed to PostgreSQL': Realtime is watching the table. If your events still don't arrive, something filters them out: sections 4 to 7.status: 'error',Unable to subscribe to changes with given parameters. Please check Realtime is enabled…: section 2.status: 'error',An exception happened…orError parsing `filter` params: section 3.
If the status is CHANNEL_ERROR or TIMED_OUT instead, the channel didn't join at all, and err holds the reason. CLOSED means the channel was closed, by your own cleanup or by the server.
2. "Unable to subscribe to changes": the table isn't in the Realtime publication
Realtime only watches the tables listed in a publication called supabase_realtime. Creating a table and turning on Realtime for it are two separate steps. When the table isn't listed, the system message says:
Unable to subscribe to changes with given parameters. Please check Realtime is enabled for the given connect parameters: [event: *, schema: public, table: notes, filters: [], select: nil]
See which tables are listed in the SQL Editor:
select schemaname, tablename from pg_publication_tables where pubname = 'supabase_realtime';
Add yours (or use Database → Publications → supabase_realtime in the dashboard):
alter publication supabase_realtime add table public.notes;
Then subscribe again. In our test, the channel opened before the fix stayed silent: Realtime doesn't retry after this error. A new subscription got the next insert right away. Reloading the page is enough.
The same message comes back when the name doesn't match exactly. In our test, table: 'Todos' for a table named todos gave it. Names are case-sensitive: copy the schema and table name from the table list.
3. A filter Realtime can't read
A filter built before the user is loaded, like filter: `user_id=eq.${user?.id}`, sends the word undefined. In our test, the system message said:
Unable to subscribe to changes with given parameters. An exception happened so please check your connect parameters: [event: *, schema: public, table: todos, filters: [{"user_id", "eq", "undefined", false}], select: nil]. Exception: ERROR 22P02 (invalid_text_representation) invalid input syntax for type uuid: "undefined"
Don't open the channel until you have the ID. In React, return early from the effect while user is missing, and put user?.id in its dependencies so it runs again once the user arrives. The same empty-variable problem in ordinary queries is covered in invalid input syntax for type uuid: "undefined".
A filter written like SQL, user_id = ${id} or user_id=${id}, gave this, with your value in the brackets:
Error parsing `filter` params: [" 6f1c2a9e-…"]
Realtime doesn't retry after these errors either: fix the filter, then open the channel again. The format is column=operator.value, with no spaces: user_id=eq.${id}. The usual operators are eq, neq, lt, lte, gt, gte and in (status=in.(open,done)).
4. "Subscribed to PostgreSQL" but nothing arrives: Row Level Security
For every INSERT and UPDATE, Realtime checks whether the subscriber could read the new row, as that user, with your RLS policies. If not, the event isn't sent, and nothing tells you. In our tests:
- A signed-in user never got events for another user's rows. That's RLS doing its job.
- A table with RLS on and only an insert policy, no select policy, sent nothing, not even for the user's own rows. A select run as that user returned 0 rows for the same table.
- A client that wasn't signed in (the anon key) got nothing from a policy written
to authenticated.
To check, run the same select with the same client: await supabase.from('posts').select('*'). If data is empty while the table has rows, the policy is what hides them. The fix is a select policy that lets the user read the rows they should see:
create policy "read own posts" on public.posts
for select to authenticated
using (user_id = auth.uid());
In our test, the next insert arrived on the channel that was already open, without subscribing again: policies are checked on each event.
One thing that looks like a fix but isn't: in our test, a client created with the service_role key received every row, other users' rows included, because that key skips RLS. Never put it in the browser. If your server gets events with that key while your app gets none, that's the sign your users can't read those rows.
5. Signed in after subscribing
If the channel opens before the user is signed in, it starts with the anon key and gets nothing from policies written for signed-in users. At sign-in, supabase-js passed the new token to Realtime by itself, and a second Subscribed to PostgreSQL message arrived 1.1 to 1.8 seconds later in our five runs. A row written 0.2 seconds after the sign-in was lost every time; one written 4 seconds after arrived every time. Realtime's source waits a random 1 to 3 seconds before it subscribes again with the new token.
So open the channel after sign-in, for example in an effect that depends on the user's ID. If you can't, treat the second Subscribed to PostgreSQL message as the moment your events start.
6. UPDATE and DELETE events that don't come
An update that hides the row. For an UPDATE, Realtime checks the new version of the row only. Our policy hid archived rows: moving a row from open to archived sent nothing to its owner, and moving it back sent the event. If your app needs to know when a row leaves the list, the user must still be allowed to read the row after the change.
DELETE with a filter. By default, Postgres only records the primary key of a deleted row. In our test, a DELETE subscription with filter: `user_id=eq.${id}` got nothing. After this, it got the next delete:
alter table public.todos replica identity full;
A filter on the primary key (id=eq.14) worked without it.
RLS doesn't apply to DELETE. Realtime can't check a row that no longer exists. In our test, every subscriber of the table got every DELETE, other users' rows included, with only the ID in payload.old. Don't put anything in the primary key that other users shouldn't see.
Empty payload.old. With the default setting, payload.old holds only the primary key, for updates and deletes. With replica identity full, our UPDATE events carried the whole old row, even with RLS on. DELETE events on a table with RLS still carried only the ID.
7. Rows written right after SUBSCRIBED
When Realtime has just started watching your database (the first subscriber after a quiet period or a restart), it needs a moment after the join before it really captures changes. On a freshly started Realtime, SUBSCRIBED came after about 40 ms in our tests, but Subscribed to PostgreSQL only after 2 to 2.8 seconds. Rows written in that gap never arrived: in each run, every write made in the first second after SUBSCRIBED was lost, and every write made after the ok message arrived. On a Realtime already serving other channels, rows written the moment SUBSCRIBED came all arrived (3 of 3).
This bites tests, demos and pages that insert a row right after subscribing to see it appear. Write only after the system message says ok:
supabase
.channel('todos-feed')
.on('system', {}, (msg) => {
if (msg.extension === 'postgres_changes' && msg.status === 'ok') startWriting()
})
.on('postgres_changes', { event: 'INSERT', schema: 'public', table: 'todos' }, onInsert)
.subscribe()
supabase-js 2.119 also has a channel option meant for this: supabase.channel('todos-feed', { config: { postgres_changes_options: { wait: true } } }) holds SUBSCRIBED back until Realtime has subscribed. It didn't make early writes safe every time. SUBSCRIBED and the ok message came together, 170 to 280 ms after the call. In two of our five runs, rows written in the next 250 ms were still lost; in the other three, none were. Either way, load the current rows with a normal query once you're subscribed. A missed event then costs you nothing.
8. React: "cannot add `postgres_changes` callbacks … after `subscribe()`"
This error is thrown when .on('postgres_changes', …) is called on a channel that has already been subscribed:
Error: cannot add `postgres_changes` callbacks for realtime:todo-feed after `subscribe()`.
supabase.channel('todo-feed') hands back the channel that's already open under that name. So an effect that runs a second time without removing the first channel crashes with this error. Remove the channel in the effect's cleanup:
useEffect(() => {
if (!user) return
const channel = supabase
.channel(`todos-${user.id}`)
.on('postgres_changes', { event: '*', schema: 'public', table: 'todos', filter: `user_id=eq.${user.id}` }, onChange)
.subscribe()
return () => { supabase.removeChannel(channel) }
}, [user?.id])
In our test, a cleanup followed at once by a new channel with the same name worked, and so did the sequence React StrictMode runs in development (subscribe, clean up, subscribe again, all at once).
9. Events that arrive empty
If the callback runs but payload.new is {}, read payload.errors. We saw two:
["Error 401: Unauthorized"]: the role lost its read permission on the table. In our test,revoke select on public.todos from authenticatedcaused it, andgrant select on public.todos to authenticated;fixed it.["Error 400: Bad Request, no primary key"]: the table has no primary key. Add one.
If an AI tool built your app
Give your tool this prompt:
My Supabase Realtime subscription (postgres_changes) says SUBSCRIBED but the callback never runs. Add .on('system', {}, (msg) => console.log(msg)) to the channel and log (status, err) in .subscribe(). Then check, in this order: the table is in the supabase_realtime publication (alter publication supabase_realtime add table public.TABLE); the subscriber has a SELECT policy on the table that matches the rows (RLS); the filter uses column=eq.value with no undefined value; the channel is opened after the user is signed in and removed in the useEffect cleanup. Show me the SQL to run in the Supabase SQL Editor and the corrected subscription code.
Not quite your error?
- Your writes fail with "new row violates row-level security policy": the insert policy is missing.
- "permission denied for table" on ordinary queries: the role has no grant on the table.
- Queries fail with invalid input syntax for type uuid: "undefined": a variable was empty when the query ran.
- "JWT expired" on your requests: the session token wasn't refreshed.
Still stuck?
Strip the subscription down to { event: '*', schema: 'public', table: 'your_table' }, no filter, and write a row from the SQL Editor once the system message says ok. If that row arrives, put your filter back. If it doesn't, the cause is the publication (section 2) or RLS (section 4). Realtime doesn't promise to deliver every event: if missing one would hurt, use the event as a signal to fetch the data again.
Other Supabase problems? See Supabase fixes.