From 5291a8a95a1c05c47c82cbc37e5af5ac99757ab0 Mon Sep 17 00:00:00 2001 From: chahinebrini Date: Mon, 11 May 2026 17:19:37 +0200 Subject: [PATCH] =?UTF-8?q?fix(realtime):=20domainRealtime=20CHANNEL=5FERR?= =?UTF-8?q?OR=20=E2=80=94=20wrong=20filter=20column=20+=20missing=20public?= =?UTF-8?q?ation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- apps/rebreak-native/hooks/useDomainSubmissionRealtime.ts | 2 +- .../migration.sql | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 backend/prisma/migrations/20260511_fix_realtime_user_custom_domains/migration.sql diff --git a/apps/rebreak-native/hooks/useDomainSubmissionRealtime.ts b/apps/rebreak-native/hooks/useDomainSubmissionRealtime.ts index 7557f7e..62d2adb 100644 --- a/apps/rebreak-native/hooks/useDomainSubmissionRealtime.ts +++ b/apps/rebreak-native/hooks/useDomainSubmissionRealtime.ts @@ -37,7 +37,7 @@ export function useDomainSubmissionRealtime( event: "*", schema: "rebreak", table: "domain_submissions", - filter: `submitter_id=eq.${myId}`, + filter: `user_id=eq.${myId}`, }, () => onChange(), ) diff --git a/backend/prisma/migrations/20260511_fix_realtime_user_custom_domains/migration.sql b/backend/prisma/migrations/20260511_fix_realtime_user_custom_domains/migration.sql new file mode 100644 index 0000000..3406319 --- /dev/null +++ b/backend/prisma/migrations/20260511_fix_realtime_user_custom_domains/migration.sql @@ -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;