Unknown Error on Channel for realtime subscriptions after updating to latest libraries
I updated everything yesterday and have started getting errors from the realtime subscriptions in my test env:
This was the websocket conversation:
The log of the realtime docker container:
So it is saying the token is invalid... but that's not a normal auth token as per https://supabase.com/docs/guides/realtime/error_codes, and obviously I'm using the token to fetch all the data on the screen so it should be valid.
I've tried removing and rebuilding the whole local docker setup. Anything I can do further with this to debug it?
1 Reply
so it turns out it is a token problem but its still confusing. The first message to realtime (as posted above) doesn't include the access token. If I change my code to retry the subsription then the second try succeeds. It's like realtime is not getting the access token the first time it tries, even though the client is logged in. In fact, I know it has the access token because I can call:
and it outputs the token, but the subsequent first subscription still fails
If I put this:
In my onAuthStateChange handler then things work as they did before I updated. This seems like a bug or I'm initializing things incorrectly somewhere