fix(realtime): domainRealtime CHANNEL_ERROR — wrong filter column + missing publication

Two bugs caused the domainRealtime channel to fail with CHANNEL_ERROR and
reconnect-loop every 3s (which also dragged down the notifRealtime channel via
the shared websocket close):
  1. useDomainSubmissionRealtime.ts filtered domain_submissions on a column that
     doesn't exist (`submitter_id`) — the actual column is `user_id`. Postgres
     raised on the publication-side filter registration → CHANNEL_ERROR.
  2. rebreak.user_custom_domains was never added to the supabase_realtime
     publication — the channel also subscribes to that table. New migration
     20260511_fix_realtime_user_custom_domains adds it.

(Diagnosis via backyard agent against the self-hosted Supabase on the Hetzner box.)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
chahinebrini 2026-05-11 17:19:37 +02:00
parent 33f411ab55
commit 5291a8a95a
2 changed files with 10 additions and 1 deletions

View File

@ -37,7 +37,7 @@ export function useDomainSubmissionRealtime(
event: "*",
schema: "rebreak",
table: "domain_submissions",
filter: `submitter_id=eq.${myId}`,
filter: `user_id=eq.${myId}`,
},
() => onChange(),
)

View File

@ -0,0 +1,9 @@
-- Enable Supabase Realtime for user_custom_domains table.
-- Fixes the remaining CHANNEL_ERROR in the domainRealtime subscription:
-- useDomainSubmissionRealtime.ts subscribes to rebreak.user_custom_domains, but
-- that table was never added to the supabase_realtime publication — so the whole
-- channel (which also covers domain_submissions + notifications) failed with
-- CHANNEL_ERROR and reconnect-looped every 3s.
-- (Companion fix in the RN code: the domain_submissions filter used a non-existent
-- column `submitter_id` — corrected to `user_id`.)
ALTER PUBLICATION supabase_realtime ADD TABLE rebreak.user_custom_domains;