Search code examples
javascriptsupabasesupabase-databasesupabase-jssupabase-realtime

Supabase realtime filter on DELETE event not working


I've noticed that filtering works as expected when listening for UPDATE events, but not for DELETE events.

I've verified that I have all the Replication settings enabled, and have run the alter table "test" replica identity full; command.

When I run the code below, the function that currently logs the payload executes any time any row is deleted from the table, even though I have a filter for rows where id == rowId.

Is this the expected behavior, or am I doing something wrong?

supabase
    .channel(`channel-delete`)
    .on(
        'postgres_changes',
        {
            event: 'DELETE',
            schema: 'public',
            table: 'test',
            filter: `id=eq.${rowId}`
        },
        (payload) => {
            console.log(payload);
        }
    )
    .subscribe();

Solution

  • This is actually a known issue with Supabase. You can follow the GitHub issue here: https://github.com/supabase/walrus/issues/53