ยฉ 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabaseโ€ข4y agoโ€ข
7 replies
Jeremy Deceuster

React Realtime subscription not working

I'm trying to listen to inserts on my "messages" table in a React Project, but when I add a message to the table, the console log is not printed.

Here's the code:

useEffect(() => {
    console.log("listening");
    supabase
      .channel("public:messages")
      .on(
        "postgres_changes",
        { event: "INSERT", schema: "public", table: "messages" },
        (payload) => {
          console.log("Change received!", payload);
        }
      )
      .subscribe((status) => console.log(status));
  }, []);
useEffect(() => {
    console.log("listening");
    supabase
      .channel("public:messages")
      .on(
        "postgres_changes",
        { event: "INSERT", schema: "public", table: "messages" },
        (payload) => {
          console.log("Change received!", payload);
        }
      )
      .subscribe((status) => console.log(status));
  }, []);


What I see in the console:
"listening"
"SUBSCRIBED"

Realtime is enabled, I removed StrictMode, tried older and version 2.0.0 of supabase/supabase-js.

Anyone can help me with this?
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Realtime subscription stopped working
SupabaseSSupabase / help-and-questions
4y ago
Realtime subscription callback not working as expected
SupabaseSSupabase / help-and-questions
4y ago
realtime subscription reliability
SupabaseSSupabase / help-and-questions
7mo ago
Realtime not working
SupabaseSSupabase / help-and-questions
4mo ago