Hi All - does anyone know why my realtime updates ...
# off-topic
e
Hi All - does anyone know why my realtime updates might have just stopped working? Looking in network requests, I can see that the WS request to
: wss://XXXXXX.supabase.co/realtime/v1/websocket?apikey=XXXXX
just stays as Pending with a 101 response? All replication etc on Supabase seems to enabled etc so seems to be client related
g
Pretty sure 101 is normal. I see that response on all websockets and the messages inside go back and forth to the server.
e
Mmm, after 10 minutes though, I can see an error in the console
Unchecked runtime.lastError: The message port closed before a response was received.
g
SO... I have an open issue that realtime loses connection on Chrome and Edge at least after 10 minutes in the background
e
Although after that I can see multiple websocket calls with 101 in there
Not getting any errors or anything with realtime, but no data being pushed through either
Copy code
js
await supabase
.from(`platform:platform=eq.${router.query.platformCode}`)
.on("INSERT", (payload) => {
  console.log("data", payload)})
.subscribe();
g
So realtime will just keep trying to restore the connection when it is dropped. Is your tab in background when it starts failing? https://github.com/supabase/realtime-js/issues/121
you can also get more information on the connection with subscribe((status,e)=>{ console.log('subscribe status,error',status,e); })
e
It mostly likey is., although an immediate insertion of data after loading with it in the foreground still doesnt get through. Let me see if that gives me any more information
`Nope, subscribe status,error SUBSCRIBED undefined
g
Then was it working recently? You need to have read RLS working to get back status even on insert. Make sure you have latest drivers.
e
Yep, it worked certainly a few months ago, and hasn't been rebuilt since then
Interestingly, it seems to flip between the 2 states
g
You need to look at the messages in the first websocket on the network tab to see what it dies on. You maybe fighting two things at once. First get your insert to trigger right up front. The later stuff looks like what I get with some browsers when the tab is not in focus for awhile.
e
^^ that actually happened whilst it was in focus 😦
g
well look at the messages in the socket you should see the failing message
There should be lots of heartbeat messages every 30 seconds while websocket is connected.
e
yep i can see that
g
what are the last few messages in one of the sockets?
Look at the time between the groups, should be 30seconds or so, does the last heartbeat take longer to get out?
e
all of them are 30s apart
xx:xx:08 xx:xx:38
OK well no idea whats going on. Just deleted node_modules and did npm i, now its working
same versions etc
g
😎
e
typical 😄
delete node_modules and reinstall is definitely the "turn it off and on again"
g
leave your error checking in for awhile if you are going into background tab on chrome or edge.
e
will do 🙂
thanks