MongoDB Realm all users automatically loggingout after deployment

I am using MongoDB Realm for authentication in my Rest API writen in node js.

When I do the deployment that Realm authorization token getting expired for all the users. My assumption is MongoDb Realm is creating temp files inside the application directory and using that for authorization. Users are getting logged out because of this files are getting deleted during the deployment.

If anyone has some idea please help me out

Are this temporary files needed?


Yes, that’s correct: the files inside the mongodb-realm/<app-id>/server-utility/metadata folder keep some information about the users that have logged in. It’s also possible to open the .realm file with Realm Studio, and check the identities. If, as part of your deployment, you delete that folder, that information is gone, and a new login is needed (even though you never did an explicit logout).

1 Like

Hi @Paolo_Manna
I will explain the deployment process we follow. Each time we make changes in the source code, During the deployment, we create a new docker image. This new image gets deployed in AWS EC2. Even if we are doing the source code change in a single file. The new docker image will replace the old docker image. (We are following this method from the beginning of this project) So my assumption is the temporary files associated with old docker images get lost during the deployment process. So all the users are getting logout. Is there method to get old realm tempfile?