SendBirdException: User doesn't exist or has been deleted

I’m having issues using SendBird UIKit on Android. The version I’m using is sendbird uikit 1.2.3

Over the last few weeks I’ve received complaints from user who are not able to user the integrated chat within our Android App. Looking at the logs (Crashlytics), we’ve found that there are lots of non-fatal exceptions when trying to use SendBirdUIKit. The errors are always happening in the same spot, when calling SendBirdUIKit.connect method. Here is the stack trace found in the logs:

Non-fatal Exception: com.feverup.fever.chat.model.SendBirdException: com.sendbird.android.SendBirdException: User doesn’t exist or has been deleted.
at com.feverup.fever.chat.SendBirdChatService$connect$1.onConnected(SendBirdChatService.java:36)
at com.sendbird.uikit.SendBirdUIKit$1.onResultForUiThread(SendBirdUIKit.java:216)
at com.sendbird.uikit.SendBirdUIKit$1.onResultForUiThread(SendBirdUIKit.java:189)
at com.sendbird.uikit.tasks.JobResultTask$1.lambda$call$0(JobResultTask.java:35)
at com.sendbird.uikit.tasks.-$$Lambda$JobResultTask$1$Y7W6dkDafjyS2A31IT22Q8Gkd_0.run(-.java:8)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6702)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)

We’ve checked in SendBird’s dashboard and the user does exist.

Has anyone experienced the same issue? Any tip on how to solve it?

Hey @Carlos_Salguero,

Can you show me how you are setting the UserInfo?

Hi, thanks for the response. The UserInfo is passed along in the init method of SendBirdUIKit, like this:

SendBirdUIKit.init(CustomSendBirdUIKitAdapter(appId, userId, userToken, userNickname), context)

where CustomSendBirdUIKitAdapter is:

class CustomSendBirdUIKitAdapter constructor(
    private val appId: String,
    private val userId: String,
    private val userAccessToken: String,
    private val userFullName: String) : SendBirdUIKitAdapter {

override fun getAppId(): String? {
    return appId
} 
override fun getAccessToken(): String? {
    return userAccessToken
}

override fun getUserInfo(): UserInfo? {
    return object : UserInfo {
        override fun getUserId(): String {
            return this@CustomSendBirdUIKitAdapter.userId
        }

        override fun getNickname(): String {
            return userFullName
        }

        override fun getProfileUrl(): String {
            return ""
        }
    }
}
}

Init method is called when entering the chats screen and after that, a call to SendBirdUIKit.connect is done. As stated in the documentation, calling init several times should be totally fine…

Thanks so much in advance

The WebSocket connection is called automatically when you enter the UIKit’s ChannelFragment.

So I guess that the error logs that you attached might be printed because the automatic connection which UIKit did is already called before you set the init function.

I need more detailed information.

  1. Did you call the SendBirdUikit.connect() after SendBirdUikit.init()? If it isn’t too much trouble with you, would you give code snippets regarding this part?

  2. Is the problem occurring the app crash or does it just print logs?

  3. Can you check if it’s okay to call init function from the application’s onCreate instead of when you’re entering the channel?

Thanks.

1 Like

Thanks again for your answer.

Responding to your questions:
1.- Yes, we call SendBirdUiKit.connect(). after SendBirdUiKit.init(). Here is our code:

override fun connect(userId: String, userToken: String, userNickname: String, listener: ChatConnectionListener?) {
             SendBirdUIKit.init(FeverSendBirdUIKitAdapter(appId, userId, userToken, userNickname), context)
             SendBirdUIKit.connect { _, error ->
                 if (error != null) {
                     ClassWiring.getServiceLocator().crashlyticsManager.log("SendBirdChatService: error = unable to connect: appid: $appId, userId: $userId, userToken: $userToken, userNickname: $userNickname")
                     ClassWiring.getServiceLocator().crashlyticsManager.logException(SendBirdException(error))
                     listener?.onError()
                 } else {
                     listener?.onConnected()
                     configurePush()
                 }
             }
         }

It is worth mentioning that we only call this function if the user is not already connected, using the following snippet:
SendBird.getConnectionState() == SendBird.ConnectionState.OPEN

2.- The app is not crashing, but we are getting quite a lot

Non-fatal Exception: com.feverup.fever.chat.model.SendBirdException
com.sendbird.android.SendBirdException: User doesn't exist or has been deleted.
com.feverup.fever.chat.SendBirdChatClient$connect$1.onConnected
Caused by com.sendbird.android.SendBirdException
User doesn't exist or has been deleted.

3.- Calling init in app’s onCreate is not an option right now, as we get all the user’s details from backend at a later stage in the user’s flow

Thanks so much in advance

@Carlos_Salguero Thanks for your reply. The above error message can be occured if the guest login is blocked or there is no user. Could you check your application setting whether your application not allow guest login.

Hi. If I check SendBird’s dashboard, I can fin the user there. It reads it is an ACTIVATED user, but their status is Offline. The user has obviously not been deleted and I don’t see why this would be a guest login either, so I don’t get why I’m still getting this Non-fatal Exception:

com.feverup.fever.chat.model.SendBirdException

com.sendbird.android.SendBirdException: User doesn't exist or has been deleted

Could you give me your APPID and user_id and could you inform me which API you requested? If then it is more helpful for me.