pusher / chatkit-client-js

JavaScript client SDK for Pusher Chatkit
https://pusher.com/chatkit
MIT License
90 stars 15 forks source link

Logger.ERROR: error establishing user subscription - Token exp (expiry) may be no more than 86400s in the future #110

Closed neuropass closed 4 years ago

neuropass commented 5 years ago

Chat was working fine until last night. I just noticed this morning is not connecting. In console I see:

Logger.ERROR: error establishing user subscription: chat-vendors.js:31:47095 Token exp (expiry) may be no more than 86400s in the future. More information can be found at https://docs.pusher.com/errors/authentication/jwt/expiry_too_far_ahead. Error object:
Object { statusCode: 401, headers: {…}, info: {…} } chat-vendors.js:31:46982 Could not connect to Pusher Object { statusCode: 401, headers: {…}, info: {…} } app.js:1:40249

network tab I also see a 101 code: https://gyazo.com/b1b360ba7d9433905323c0eb6d59cf9d
mdpye commented 5 years ago

Hi, is your server (which is generating the tokens) clock accurate? Has it shifted recently, perhaps as a result of daylight savings time?

neuropass commented 5 years ago

well this was rather strange... yes I think it was due to the daylight savings time as the error was gone a day later. @mdpye but how can this happen? If the server was updated automatically why would the error persist a full day? so basically my thinking is, this will happens twice per year lol how do we prevent this?

neuropass commented 4 years ago

This issue is back. My chat instance is not working anymore and its the same error. why does it error out with this time change situation?

neuropass commented 4 years ago

and today is working again. this is bug then. @callum-oakley This happened again on the time change. @callum-oakley @mdpye Can you guys confirm that pusher server has an issue with the time change sync perhaps? this is causing chats to stop working as pusher server time changes.

mdpye commented 4 years ago

Hi. I can confirm that the Pusher servers almost certainly don't have an issue with the clock change - they run in UTC year round, so they do not experience a change.

I would suggest that you check the clocks on your servers, and if that doesn't immediately resolve the problem, then get in touch with support@pusher.com who can dig deeper in to the issue with you.

benw-pusher commented 4 years ago

Hi @neuropass could you let me know what server SDK you are using for authorisation? Ben

neuropass commented 4 years ago

Hi Ben, turns out its a problem with the pusher PHP sdk. I was told by my head developer there is a function that calculates the time that is a very unreliable logic. In fact they just added a pull-request here: https://github.com/pusher/chatkit-server-php/pull/62

benw-pusher commented 4 years ago

Thanks Neuropass. Indeed, that PR is why I was checking here - wanted to ensure your issue would be solved b the PHP PR.

Thanks for confirming.

Michaelvons commented 4 years ago

Solved !! [Fix] Try restarting your emulator.