supabase / supabase

The open source Firebase alternative.

Home Page:https://supabase.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The postgres subscription is not working at all

ivan-robert opened this issue · comments

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

I have a mobile app where I listen to postgres changes with a subscription. It worked perfectly fine until some weeks ago (I have not checked this feature for some time, I don't have the precise date when it broke).
I haven't changed a line of code. Now none of my subscriptions are working. I guess something changed supabase-side, because my code is still the same.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

export const subscribeToNotificationsAPI = ( userId: string, callback: (payload: NotificationUpdate) => void ) => { supabaseClient .channel(notifications-${userId}) .on( "postgres_changes", { event: "*", schema: "public", table: "notifications", filter: user_id=eq.${userId}, }, (payload) => { console.log("nothing happens, even if I send a notification"); callback(payload as unknown as NotificationUpdate); } ) .subscribe(); };

this function is called at the root of my app inside a useEffect. I checked it was called, it is.

Expected behavior

My console log is supposed to fire when adding a row to notifications table

System information

  • OS: MacOS (iOS simulator, react native)
  • Version of supabase-js: [2.42.3]
  • Version of Node.js: [20]

Hey there, thanks for opening!
If you have not touched it for some weeks, lets check some things before we debug further:

  • Is the project still running and not paused?
  • In the dashboard, can you access the Realtime Inspector and join those channels?
  • Have you tried toggling the realtime subscriptions or checking for output in the logs?

@encima Hello, thank you for your fast reply. You talking about the project and the dashboard gave me a hint about what I did wrong. The only thing that changed was my backend project, going from staging to production... and the realtime turned off on the tables !!

I turned it on again and of course everything worked fine again. I am sorry for the inconvenience and thank you for your patience 🙏