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 presence subscription: Logger.ERROR: Error: presence subscription timed out #95

Closed hbole closed 6 years ago

hbole commented 6 years ago

componentDidUpdate(){ if(this.state.userId){ const chatManager = new Chatkit.ChatManager({ instanceLocator: 'API KEY', userId: this.state.userId, tokenProvider: new Chatkit.TokenProvider({ url: 'Test Url Token' }) }) chatManager.connect() .then(currentUser => { this.currentUser=currentUser this.getRooms()
}) .catch(err => { console.log('Error on connection', err) }) } } getRooms=()=>{ this.currentUser.getJoinableRooms() .then(joinableRooms => { this.setState({ joinableRooms, joinedRooms: this.currentUser.rooms }) }) .catch(err => console.log('error on joinableRooms: ', err)) } subscribeToRoom=(roomId)=>{ this.setState({ messages: [] }) this.currentUser.subscribeToRoom({ roomId: roomId, hooks: { onNewMessage: message => { this.setState({ messages: [...this.state.messages, message] }) } } }) .then(room => { this.setState({ roomId: room.id, roomName:room.name }) this.getRooms() }) .catch(err => console.log('error on subscribing to room: ', err)) } sendMessage=(text)=>{ this.currentUser.sendMessage({ text:text, roomId:this.state.roomId }) } createRoom(name) { this.currentUser.createRoom({ name }) .then(room => this.subscribeToRoom(room.id)) .catch(err => console.log('error with createRoom: ', err)) }

vivangkumar commented 6 years ago

We've identified and fixed the issue on our end. However, we're still monitoring it. If you do notice anything, please let us know.

For anyone interested: it seemed to be an in cluster networking issue.

Thank you for you patience.

neuropass commented 6 years ago

Well this is it. This is what I wanted to hear. Many Thanks @vivangkumar and all the others here who could give better information on how to track this bug down! We'll monitor results and report if any issues. Thansk again pusher team!

irajwani commented 6 years ago

Thank you for the fix; it did seem to be much better until I once again received the following error. It just randomly popped up again, and will not go away, even though my project seemed to work for extended periods of time earlier this afternoon. screen shot 2018-10-11 at 10 01 09 pm

irajwani commented 6 years ago

To clarify, this issues pops up sporadically. For every 2 times my project works flawlessly, this error crops up on the third build, but not in that exact manner of course. When this error does occur, it seems to be due to the invocation of: const chatManager = new Chatkit.ChatManager({ instanceLocator: CHATKIT_INSTANCE_LOCATOR, userId: CHATKIT_USER_NAME, tokenProvider: tokenProvider });

OR

chatManager.connect().then(....)

Please help Pusher Team. Of course, this error may be local to my project due to some error in the code I don't recognize, but that wouldn't explain why the app seems to work just fine on some builds.

pattruong commented 6 years ago

I have also been experiencing the same error sporadically. This morning the fix seemed to have cleared up my error for a few hours, but now it seems that it's back again.

RobinJayaswal commented 6 years ago

@vivangkumar I can also confirm that the error is happening to me again right now. Thanks for the quick response yesterday, glad to hear the Pusher team is working on it.

neuropass commented 6 years ago

Yup happening right now. It's 9:50pm. (CT) was fine all day today.

blakebodycote commented 6 years ago

I have the same issue unfortunately. I'm hoping this isn't too common as I'm using this for a university assignment where it has to be working when I present my project :/

neuropass commented 6 years ago

@vivangkumar is this issue for the US cluster? https://gyazo.com/fc8bc6952427b16a14e4839cf1c33339

Is there a way we can change cluster from our dashboard? would be also useful at this point to see if indeed its happening for US only.

Still not accessible and this is 2 hours later. :-/

vivangkumar commented 6 years ago

Hey guys!

There isn't a way to change the cluster since it is the only cluster we have. I'll have a word with the team to try and get to the bottom of this.

vivangkumar commented 6 years ago

Hey guys!

@neuropass @hbole @italoj @RobinJayaswal Have you guys set timeouts on the client or are you using the default timeouts?

hamchapman commented 6 years ago

We've published version 0.7.18 of the SDK. Please try updating to this version to see if this fixes the issue.

If you're still experiencing problems please provide the following information:

irajwani commented 6 years ago

Hey guys!

@neuropass @hbole @italoj @RobinJayaswal Have you guys set timeouts on the client or are you using the default timeouts?

@vivangkumar Don't know if this helps; I set a timeout of 1000 milliseconds before the instantiation of new Chatkit.ChatManager({ instanceLocator: CHATKIT_INSTANCE_LOCATOR, userId: CHATKIT_USER_NAME, tokenProvider: tokenProvider }); chatManager.connect().then(...);

The new version of the SDK has been working perfectly for last few hours, though this error did pop up a few times after the library had been freshly installed:

screen shot 2018-10-12 at 9 11 47 pm

neuropass commented 6 years ago

Happening again right now. looks like it starts happening late in the afternoon and on. Not before. Its not happening during the day at least as far I can see.

Timeouts is the default chatkit timeout in my case. Nothing that modifies the default library behavior in other words.

sammccord commented 6 years ago

Can verify this is still happening with 0.7.18 and test token provider endpoint. It's never worked for me, not even a fraction of the time with various timeouts set, same logs as @irajwani Would rather not roll my code back to using sendbird...

kristiankyvik commented 6 years ago

Happening right now for me. Has worked all day until now!

neuropass commented 6 years ago

Here we go again happening... so it happens from middle afternoon and on it seems. 5.54PM (CT) Demos are offline too.

Logger.ERROR: error establishing presence subscription: Logger.ERROR: Error: presence subscription timed out

neuropass commented 6 years ago

5 hours later still error :-/

m1771vw commented 6 years ago

Hi Pusher Team,

Regarding latest SDK changes, I updated and am still receiving this error.

Chance of errors (i.e. does it happen every time or is it 1 in 3 times you run your app, or 1 in 10, etc?)

Happens every time, for the past hour since updating. Was not able to successfully subscribe.

SDK, including version, that you're using

0.7.18

All logs you see when the error occurs

image

image

offminded commented 6 years ago

+1 I have been receiving the same error lately.

neuropass commented 6 years ago

Down again. So no correlation with the time of the day. It just goes into error often.

Logger.ERROR: Error: user subscription timed out Could not connect to Pusher Error: user subscription timed out

[object Error]: {description: "user subscription timed out", message: "user subscription timed out", stack: "Error: user subscription timed out at Anonymous function

We've identified and fixed the issue on our end. However, we're still monitoring it. If you do notice anything, please let us know.

For anyone interested: it seemed to be an in cluster networking issue.

Thank you for you patience.

@vivangkumar Any update on this issue? Right now chatkit its pretty much unusable...

callum-oakley commented 6 years ago

Just dropping a comment here to let you know we're aware of the current issue and are working on it. Hopefully we'll have things up and running again asap, and get this fixed for good 🤞

neuropass commented 6 years ago

@vivangkumar @callum-oakley Ok thanks so much!

I just noticed something very interesting, perhaps useful for debugging. This is the scenario:

-some users were already connected to the chat and chatting successfully. (3 users in this test case) -Now some new users who just logged-in in the chat for the first time, got the logger error.

The users already connected were just fine, the new users could not connect and chat at all.

callum-oakley commented 6 years ago

The above issue should be resolved now, and we think we've finally gotten to the bottom of the timeouts. No need to update clients, it was purely a server side fix.

Thanks for bearing with us on this. If anyone sees the problem reoccur it would be really helpful if you could open a new issue with more details. This one has gotten fairly noisy, and has a lot of information about related but subtly different problems in the mix.

neuropass commented 6 years ago

The above issue should be resolved now, and we think we've finally gotten to the bottom of the timeouts. No need to update clients, it was purely a server side fix.

Thanks for bearing with us on this. If anyone sees the problem reoccur it would be really helpful if you could open a new issue with more details. This one has gotten fairly noisy, and has a lot of information about related but subtly different problems in the mix.

Just wanted to point out that since yesterday the chat has been working fine... Thanks again for looking into this.

callum-oakley commented 6 years ago

Hooray! Thanks for letting us know :)

I'm going to close this issue in that case.

skout90 commented 5 years ago

Check Dashboard => credentials

tapz commented 5 years ago

I'm still getting this error every now and then. The JavaScript side of the mobile app freezes.

12-20 23:39:03.245 29594 29808 I ReactNativeJS: ┐ 
12-20 23:39:03.246 29594 29808 E ReactNativeJS: │ 'Logger.ERROR: ', 'error establishing user subscription:'
12-20 23:39:03.304 29594 29808 E ReactNativeJS: │ 'Logger.ERROR: ', [Error: user subscription timed out]
12-20 23:39:03.319 29594 29808 I ReactNativeJS: ┘ 
12-20 23:39:03.331 29594 29808 I ReactNativeJS: 'Failed to connect to chat.', { [Error: user subscription timed out]
12-20 23:39:03.331 29594 29808 I ReactNativeJS:   line: 175913,
12-20 23:39:03.331 29594 29808 I ReactNativeJS:   column: 80,
12-20 23:39:03.331 29594 29808 I ReactNativeJS:   sourceURL: 'http://localhost:8081/index.android.delta?platform=android&dev=true&minify=false' }
12-20 23:39:03.346 29594 29808 I ReactNativeJS: ┐ 
12-20 23:39:03.347 29594 29808 E ReactNativeJS: │ 'Logger.ERROR: ', 'error establishing cursor subscription:'
12-20 23:39:03.360 29594 29808 E ReactNativeJS: │ 'Logger.ERROR: ', [Error: cursor subscription timed out]
12-20 23:39:03.371 29594 29808 I ReactNativeJS: ┘ 
12-20 23:39:03.372 29594 29808 I ReactNativeJS: ┐ 
12-20 23:39:03.373 29594 29808 W ReactNativeJS: │ 'Logger.WARNING: ', 'error establishing presence subscription:'
12-20 23:39:03.375 29594 29808 W ReactNativeJS: │ 'Logger.WARNING: ', [Error: presence subscription timed out]
12-20 23:39:03.377 29594 29808 I ReactNativeJS: ┘ 
onisaint commented 5 years ago

image still happening! please help. thanks in advance. Only on Mobile Builds. Working Fine on browsers. build: react-native

current solution: the issue was happening because my machine time was 2 min behind the actual time.

is the api time dependent ??

callum-oakley commented 5 years ago

@garvitkhandelwal do you have any reason to believe this is related to the issue above? If not, could you please open a new issue, otherwise this is liable to get lost!

boboci9 commented 5 years ago

Hi, I am experiencing this issue today too now. Everything was working great till yesterday but today I am having user subscription has timed out error when I try to subscribe to a room. Could anyone fix this issue for their instance? Also please let me know if you need anything to help reproduce the issue.

garvitkhandelwal commented 5 years ago

@boboci9 Please let me know if you find any solution to this problem. I've been trying to solve this for very long now.

onisaint commented 5 years ago

have you tried maintaining UTC time for the chats wrt to your servers instead of the clients?. (i have a feeling that the messages are recorded wrt to client time)

garvitkhandelwal commented 5 years ago

@madhudskumar Can you please explain? And how can I resolve this?

onisaint commented 5 years ago

@garvitkhandelwal the above-explained problem apparently tends to be with chatkit servers. I didn't implement any solution. Hoping that 99 percentile of our user's Machine time is always in sync and the issue won't arise.

edyrydberg commented 5 years ago

Hi Am experiencing this now. Everything worked well in my vue app. But implementing same in react-native throws the above error. any help will be much appreciated.

Regards.

precious-adeyinka commented 5 years ago

Hello, guys, I have been searching ing for a fix and I haven't found any, I really need help fixing this issue, please.

edyrydberg commented 5 years ago

@precious-adeyinka, Make sure your Debugger(on your dev machine) and device( ie mobile device running app) times have not drifted by more than 60s. Making sure my debugger and device do not have time drifted by more 60s solved my problem on react-native.

Hope this helps.

vishwa3 commented 5 years ago

I am also getting the same error - Console log - Console_log

Network log - Network

E01T commented 5 years ago

I get exactly the same message as above. chatkit error Any ideas?

mustran commented 5 years ago

@E01T @vishwa3 npm remove @pusher/chatkit, then npm i @pucher/chatkit-client. It solved the problem that you guys are having!

manovagyanik1 commented 4 years ago

we are still seeing this issue? Anyone else facing the same?

onisaint commented 4 years ago

manovagyanik1 commented 4 years ago

Please re-open this, if that's what most of the people are seeing.

kgpasta commented 4 years ago

+1

gegham-khachatryan commented 4 years ago

+1

gegham-khachatryan commented 4 years ago
Screenshot 2019-12-14 12 46 03
connormatheny1 commented 4 years ago

Im getting the same errors as above, i tried to follow the pusher-blackjack article and create a live blackjack game with react and go, but im getting these errors too, not sure what to do to solve

Michaelvons commented 4 years ago

Solved !! [Fix] Try restarting your emulator.