I started getting a Subscription error recently. ...
# javascript
o
I started getting a Subscription error recently.
Copy code
SubscriptionError: status= SUBSCRIPTION_ERROR  ,error= {"reason": "error occurred when joining realtime:public:orders:rider_id=eq.4919876f-993e-4dc3-94b8-a384dedd75bd with user token
I have Replication enabled for the table and RLS off since i don't need it at the moment.
Can someone please help me out?
Hello @garyaustin how are you doing? Can you help out?
g
Is it random or every time? Does it occur at start of subscription, or while it is running? Can you see the websocket messages around the failure? Any update of client code to new version? supabase-js?
Even with RLS off you have to have a valid token for the user or anon and it seems to be complaining about that.
This closed issue seems to confirm that error has to do with the token https://github.com/supabase/realtime/issues/217
o
Subscription always fail on attempt.
I'm searching for an update.
g
If you can see the websocket messages, the usertoken value might be a clue.
Client/Server realtime code was changed to add sending the token back when RLS support was added but that was months ago.
o
I'm using it on React Native. Not sure i can inspect Websocket payload.
I just updated the SDK. Let me give it a try.
My anon is set. Subscription still fails regardless.
g
Only close issues out there and not really helpful I think. https://github.com/supabase/supabase/discussions/6947 https://github.com/supabase/supabase/discussions/6522 Without seeing the websocket it is hard to know if/why the anon token is seemingly being complained about. If you are on latest code (and especially if it was working) probably sending info to support is warranted as realtime is somewhat magic at times...
o
I'll try something quick on the web.
Here's the Websocket logs @garyaustin
g
If that user_token matches the anon key on your server instance (should check on server to make sure you did not somehow reset your jwt secret, then I have nothing else other than drop the .eq filter, but I don't think the error message has to do with that. The general join packet looks correct format.
o
All tokens are the same. I never changed the JWT token.
Existing auth tokens still work.
g
I assume the realtime.subscriptions table does not even get populated... You could always try the unplug and plug in again approach and restart your instance. If you have not, please contact support with your info and symptoms. You can reference this thread or at least your websocket log. I don't see how your code is the issue if that is a valid token.
o
I don't have a subscription table.
g
yikes
o
😆
g
How old is this instance? Or are you local hosting
You are missing lots of migrations and all of the RLS stuff... Edit, well I don't know as you may have not shown in your image.
o
6 months i think.
What can i do from here?
g
support is the only one who can help with your actual instance. That table should be there. Something is wrong with the migration process if you don't have those later dates. Or if they are there, somehow your subscription table got deleted.
I don't know how you were working recently though if the migrations failed.
o
How do i reach support, via email?
g
I just looked at migrations and that table is there 7 months ago at least, so somehow it has been deleted. Home Screen:
o
Thanks @garyaustin you've always been helpful.
I appreciate you.
Hey @garyaustin
How are you doing?
g
OK
o
Support helped me out with the issue.
...with 3 simple steps.
g
That's good.
o
Copy code
drop schema realtime cascade;
create schema realtime;
and restart the server.
2 steps actually.
g
Did they say why it happened?
o
Nope! they mentioned it was weird.
g
😂
o
I guess i can close this thread now.
g
Thanks for letting me know. I'll add that somehow to future questions.
o
👍