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));
  }, []);


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?
Was this page helpful?