We should re-establish watch streams when all events are consumed, since that means the connection got closed.
We should ensure to send the _id of the last received event when resuming.
Note: Put on hold, since the server doesn't support resuming in its current state.
Is that causing "Unhandled Rejection (WatchError): rule with id="000000000000000000000000" no longer exists on mongodb service, closing watch stream"? @kraenhansen
@aureliopetrone I get that same error every 60 seconds, making watch() essentially unusable.
This reproduces it:
const Realm = require('realm');
const REALM_APP_ID = "some_app_id";
const DB_NAME = "some_db";
const COLLECTION_NAME = "some_collection";
const app = new Realm.App(REALM_APP_ID);
Realm.App.Sync.setLogLevel(app, 'debug');
const startTime = Date.now();
const go = async () => {
const credentials = Realm.Credentials.anonymous();
const user = await app.logIn(credentials);
let changes = user.mongoClient('mongodb-atlas')
.db(DB_NAME)
.collection(COLLECTION_NAME)
.watch();
for await (const change of changes) {
console.warn("CHANGE", {change});
}
}
go().catch(error => {
const endTime = Date.now();
console.error({error, startTime, endTime, elapsed: endTime - startTime})
});
Is that causing "Unhandled Rejection (WatchError): rule with id="000000000000000000000000" no longer exists on mongodb service, closing watch stream"?
I havn't been able to reproduce this with my apps so far.
@aureliopetrone & @hgoldwire I would love for you two to create your own issues on this repository, since this issue is tracking an enhancement that won't be implemented any time soon. I'm especially interested in learning more about if you're using the Realm JS or Realm Web SDK and what sort of rules you've setup on the MongoDB Realm app. A thorough bug report makes for a faster resolution of the issue. Thanks!
Is that causing "Unhandled Rejection (WatchError): rule with id="000000000000000000000000" no longer exists on mongodb service, closing watch stream"? @kraenhansen
FYI this is a server-side bug with collection.watch() on linked clusters that have Sync enabled. The team has a fix in progress so hopefully it should be resolved in the next cloud release without requiring any updates to realm-web.
Most helpful comment
FYI this is a server-side bug with
collection.watch()on linked clusters that have Sync enabled. The team has a fix in progress so hopefully it should be resolved in the next cloud release without requiring any updates torealm-web.