Realm-js: Realm Web: Resume and send resume tokens when watch streams ends prematurely

Created on 1 Oct 2020  路  4Comments  路  Source: realm/realm-js

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.

T-Enhancement

Most helpful comment

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.

All 4 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bdebout picture bdebout  路  3Comments

fever324 picture fever324  路  4Comments

ugendrang picture ugendrang  路  3Comments

jmartindivmedianet picture jmartindivmedianet  路  3Comments

laznrbfe picture laznrbfe  路  3Comments