When open app and put idle for 10 mint, sync realm give "invalid session" error on realm ui Log tab

When opening the app and put idle for 10 mint, sync realm give “invalid session” error on realm UI Log tab

@rakesh_dadhich Are you able to sync once you start using the app again?

Hello,
I do have the same issue, don’t know what it could be about.
@Ian_Ward could you please share a bit more information about syncing? Could that fix the problem?

The Realm SDK will handle refreshing the access token for you but if the app is backgrounded and goes inactive then you may get an invalid session error at first when the app goes back into the foreground. Once it gets this error it should automatically obtain a new access token

Thanks for the quick reply!

When the app tries to make a call when going back into the foreground, we get the following:

{
    "error": "invalid session",
    "error_code": "InvalidSession",
    "link":"XXX"
}

Followed by two more calls, which seem to do what you describe:

Request 1
:method: POST
:scheme: https
:authority: eu-west-1.aws.stitch.mongodb.com
:path: /api/client/v2.0/auth/session

Request 2
:method: DELETE
:scheme: https
:authority: eu-west-1.aws.stitch.mongodb.com
:path: /api/client/v2.0/auth/session

However, both result in a 401 and the app gets stuck.

Are we missing something, or is there a recommended way to handle this situation?

Thank you!

Are you able to reproduce this reliably? If so, can you upload a sample app and open a support ticket so we can sort this out for you?

*with app we mean progressive web application, so using the realm web sdk.

Will look into creating a support ticket, thanks!

Hi, I also had this problem today, which caused my Electron application to crash and not open again. I was able to open the application properly after deleting the mongodb-realm folder

And I think the reproduce of this bug is when the application is idle for a long time and the network is down or unstable during this period

We have a similar issue with Android devices. I deleted all users in Realm -> App Users and on iOS new user ID was issued when I deleted and installed the app but on Android it always uses the same user ID and it always fails with invalid session. Not sure if related to user ID but it looks like that.

We tried to delete realm files using different methods but the user ID stays the same and it looks like the user with this ID can’t be created anymore for some reason.

Hey Folks, we are in the process of improving our token refresh logic to handle this automatically. For now, you should be able to call login() with a user and continue syncing to workaround this behavior