USER_NOT_LOGED_IN issue

Hello,

We are using the Javascript SDK version 2.1.0-beta1 (“https://unpkg.com/@cometchat-pro/chat@2.1.0-beta1/CometChat.js”).

On occasion we are receiving the 'USER_NOT_LOGED_IN ’ error message at random times.
More specifically upon app login we initiate CometChat and login the user, then we can perform normal actions like making calls, sending messages etc and then all of the sudden (no pattern found) we can not do any of these actions any more as the ‘USER_NOT_LOGED_IN’ error is received.

Is there a way that we can avoid this or something that we are doing incorrectly to generate the error?

When we reload the app (so force a CometChat re-initialization) things seem to work once more, we have also tried creating fail-safes so that:
*upon receiving the error we re-initialize CometChat and then try to perform the actions behind the scenes
*we added connection listeners so that if the connection is in disconnected state for to long we force a re-initialization
*we analyzed other CometChat properties like fact that sometimes we have experience the fact that the api keys become null and in those cases we try to reinitialize the app

Is there anything that we can do to streamline this?

Best,
Mihaela

Hello,

Were you able to replicate this? Do you need additional details/research on our end?

Best,
Mihaela

Hello @MihaelaCazan,

We were not able to reproduce this issue on our end. Can you please provide any additional information so that we can try it on our end to reproduce this issue?

Hello @mayur.bhandari,

Thank you for looking more into this, we appreciate it!

About the error - all that we have right now are the logs embedded below:
**we log the section that caused the error as well as the response object received from the CometChat SDK , unfortunately noting else at the moment (we also automatically clean our logs on the regular so all of our previous error-logs are gone)
**we use UTC -8 Pacific Time (US & Canada) in case this helps you with the logs
**please note that that when experiencing this we can initially send messages (use the app) and then seemingly all of the sudden this error happens, messages can no longer be sent - if we reload the page and force a reinit/relogin etc all works OK- could we be missing a step in the app’s life cycle? (listen to a disconnect event or something to this effect and force a reconnect?)

10740853 NULL 0 0 UILogger — Page: TeleChat – Method: $scope.sendMessage – Section: CometChat.sendMessage.error — {“code”:“USER_NOT_LOGED_IN”,“name”:“user not logged in”,“message”:“An authToken is need to use the sendMessage api.”} NULL NULL NULL 2020-06-02 00:09:44.367 2020-06-02 00:09:44.367 2020-06-02 00:09:44.367 0x000000000E6F1D1E
10740857 NULL 0 0 UILogger — Page: TeleChat – Method: $scope.CometChatLogoutAndTryToInitAgain – Section: CometChat.logout.error — {“code”:“USER_NOT_LOGED_IN”,“name”:“user not logged in”,“message”:“An authToken is need to use the userLogout api.”} NULL NULL NULL 2020-06-02 00:09:45.220 2020-06-02 00:09:45.220 2020-06-02 00:09:45.220 0x000000000E6F1D22
11271641 NULL 0 0 UILogger — TeleChat Logs – PersonID: 98990614 – Page: TeleChat – Method: $scope.InitiateCall – Section: CometChat.initiateCall.error — {“code”:“USER_NOT_LOGED_IN”,“name”:“user not logged in”,“message”:“An authToken is need to use the createCallSession api.”} NULL NULL NULL 2020-06-04 05:39:01.433 2020-06-04 05:39:01.433 2020-06-04 05:39:01.433 0x000000000E7AA08F
11271645 NULL 0 0 UILogger — TeleChat Logs – PersonID: 98990614 – Page: TeleChat – Method: $scope.CometChatLogoutAndTryToInitAgain – Section: CometChat.logout.error — {“code”:“USER_NOT_LOGED_IN”,“name”:“user not logged in”,“message”:“An authToken is need to use the userLogout api.”} NULL NULL NULL 2020-06-04 05:39:02.037 2020-06-04 05:39:02.037 2020-06-04 05:39:02.037 0x000000000E7AA093
11272380 NULL 0 0 UILogger — TeleChat Logs – PersonID: 98990614 – Page: TeleChat – Method: $scope.sendMessage – Section: CometChat.sendMessage.error — {“code”:“USER_NOT_LOGED_IN”,“name”:“user not logged in”,“message”:“An authToken is need to use the sendMessage api.”} NULL NULL NULL 2020-06-04 05:43:52.410 2020-06-04 05:43:52.410 2020-06-04 05:43:52.410 0x000000000E7AA45A
11272390 NULL 0 0 UILogger — TeleChat Logs – PersonID: 98990614 – Page: TeleChat – Method: $scope.CometChatLogoutAndTryToInitAgain – Section: CometChat.logout.error — {“code”:“USER_NOT_LOGED_IN”,“name”:“user not logged in”,“message”:“An authToken is need to use the userLogout api.”} NULL NULL NULL 2020-06-04 05:43:53.020 2020-06-04 05:43:53.020 2020-06-04 05:43:53.020 0x000000000E7AA46D

Hello @MihaelaCazan,

Can you please confirm that you are not calling CometChat.logout() anywhere before getting this error?

Also, is it possible for you to provide us with a list of CometChat method you are using?

One more thing, is it possible for you to note down steps you take and when you get this error. I know this is happening intermittently but even one possible list of steps to reproduce this error would help me in getting to the root cause of this issue.

Warm Regards,

CometChat Pro
Mayur Bhandari

Hello @MihaelaCazan,

Closing this post due to inactivity.