Hey there! I'm looking at realtime, but am unable ...
# javascript
s
Hey there! I'm looking at realtime, but am unable to make it work.
Copy code
const sub = this.$supabase
   .from("actions")
   .on("*", (data) => {
     console.log(data);
   })
   .subscribe();

  console.log(sub);
My subscription look like this. The
console.log(sub)
shows that's it's seems to be ok and
joined
- Replication on my table is enabled, I can see under the websocket tab the events occuring, and i can see the subscription being created under the realtime schema in the Supabase Table's UI. So everything seems good, but i'm never reaching the callback. Nothing happen. I though it could be because of some RLS rules, but even with it being disabled on my table, nothing. Stack in Nuxt 2.x and this is inside a
mounted
method on my
Index
page. And i'm using my anon/public key Any idea? 🙏
g
Sounds like you covered the basics. Are you using anysort of database management system like Prisma? Double check your toggles for insert/delete/update and the table is toggled. Sometimes I find they get flipped off because of lag to refresh the screen. If you can see websocket does it go into a 30 second pattern of heart beat request/response?
s
Thanks for the response! I do not use anything on top of Supabase. (I even filled in my database by hand - my small app only need to be able to read a few things and insert in this "actions" table) Here is an exemple of what i get in screenshot. I think i also see this 30 sec pattern of hearbeat yeah. Are the toggles you spoke off related to Prisma or Supabase? I don't think i've seen anything about that. (The table is correctly toggles under the replication UI)
g
Your screen is hard to read, but I think I see an insert event coming back from the server.
s
Oh right, sorry. 34" will do that. Yes we're seing the INSERT with the payload containing my changes. Plus some reccuring event every 30 sec.
g
So what is the issue?
s
Copy code
.on("*", (data) => {
     console.log(data);
   })
I don't seems to be entering the fallback
g
while I'm thinking about it try this: .on("*", payload => { console.log('Change received!', payload) })
s
Nop, nothing
g
is this supabase.js?
s
It's Nuxt Supabase (https://github.com/supabase-community/nuxt-supabase) which is supposed to simply wrap around supabase.js yes
g
What is the error at bottom I can't read it. Something is going wrong in the client code or your environment processing the event. Realtime itself is up and running and sending back data.
s
The error is something else about some extension. I got it on every website.
I tried directly with supabase.js. I'm seeing the INSERT but don't enter the callback as well :/
g
What version of supabase.js?
s
1.25.2 ?
g
That is very very old.
s
Got it... i upgraded and it worked...
I am ashamed. But i didn;t think nuxt-supabase would come with an old version T_T
g
I'm adding that to my basic question list. Got burned by it twice
s
Thank you so much!