Local Realm open after synchronized on realm cloud

Javascript Realm SDK
how can I open a realm locally, after I have synchronized in the cloud.
I’m experiencing the following problem:
I have an instance in the realm cloud, that instance has been canceled, and now I am unable to open the local realm on my app.

@Royal_Advice What are you trying to do? You can open the local Realm file in Studio to view the data. You can also programmatically open the local realm in read-only mode with the various SDKs by passing a regular Configuration struct rather than a SyncConfiguration struct.

I’m trying to open a local realm that was previously synced to the cloud

i have an application and i am using cloud realm, an error occurred on the card and now my instance in the cloud is not working.
I’m getting the authentication error, because the server is not online, but I should be able to open the realm locally but I can’t.

@Royal_Advice Realm works offline but if your user session has expired you will need to get a new token from the server which requires network access. Why not re-enable your cloud instance?

about re-enable: thats what im trying to do but, im update the billing payment but its not automatically worked for me, i open a ticket, but not answer until now

about open the realm:
when i deactivate my internet i can open the realm locally, but suppose that if i am unable to stabilize a connection to the server, i will not be able to access my realm locally?

@Royal_Advice If you do not have a valid User or the User has expired then you will not be able to open the synced Realm.

I have a current user, in this case, that I can’t get a connection to the server, will I really be unable to open the realm locally?

@Royal_Advice CurrentUser is cached locally under the hood - so even if you go offline you can still open the realm

yes, but if im online, with a currentUser in cache, and i cant authenticate on the server, im unable to open the realm

without access to the cloud, will I not be able to open my realm locally?

I’m not sure how your app is coded but if you are calling .login() or using asyncOpen() these APIs require connectivity in order to function. In fact, if you call login and get rejected this may invalidate your previous valid currentUser

is there anything i can explain better so you can help me?

Are you calling login() or asyncOpen() when attempting to open the realm? What is the error?

I’m check if currentUser exists in cache, if true i call Realm.open(config), else call login.
With my cloud instance offline, i know login will not authenticate, but if im already have an user authenticated in cache with currentUser, when i call Realm.open i get auth error, because i cant make a request to it, but if i turn off the internet, i can connect locally with new Realm(config)

am i doing something wrong?
thanks for responding and for being patient

@Royal_Advice Yes new Realm is the way to go in JS to get around this - Realm.open will attempt to make a call to the server side

look, with Realm.open, if i get auth error from server (in this case with the server offline), will my current user be invalidated? all them, if i have more than 1?

…config …
sync: {
url: serverUrlFull,
error: (error) => {
console.log(error.name, error.message)
}
}

@Royal_Advice The first time you open a realm (basically the first time you run the app) you should use Realm.open() - on subsequent openings of the app you should use the new Realm API to open the already cached Realm on disk. The way to check which way you should open the Realm is to use to use different code paths on app start that are gated by a check to SyncUser.current() != NULL