Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-995

Change stream times out after a few minutes

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None

      Goals

      I would like to open a change stream to get notified of changes to a collection.

      Expected Results

      The client receives changes until the change stream is closed.

      Actual Results

      The change stream times out after a few minutes (according to the Realm logs, the stream stays open for about 90 to 240 seconds) and receives no more change events. The following error message is logged in the browser console.

      Uncaught (in promise) WatchError: execution time limit exceeded
          WatchError https://unpkg.com/realm-web@1.1.0/dist/bundle.iife.js:9540
          feedSse https://unpkg.com/realm-web@1.1.0/dist/bundle.iife.js:9686
          feedLine https://unpkg.com/realm-web@1.1.0/dist/bundle.iife.js:9611
          advanceBufferState https://unpkg.com/realm-web@1.1.0/dist/bundle.iife.js:9746
          feedBuffer https://unpkg.com/realm-web@1.1.0/dist/bundle.iife.js:9590
          watch https://unpkg.com/realm-web@1.1.0/dist/bundle.iife.js:9916
      

      Steps to Reproduce

      1. Open a change stream for a collection.
      2. Wait for two to four minutes.
      3. Insert or update a document in the collection to trigger a change event.
      4. The client doesn't receive the event and the error message appears in the console.

      Code Sample

      async function reproduction() {
        const app = new Realm.App("<app id>");
        await app.logIn(Realm.Credentials.anonymous());
      
        const collection = app.currentUser
          .mongoClient("mongodb-atlas")
          .db("<database>")
          .collection("<collection>")
      
        for await (const change of collection.watch()) {
          console.log(change);
        }
      }
      

      Version of Realm and Tooling

      • Realm JS SDK Version: 1.1.0
      • Node or React Native: Browser
      • Client OS & Version: Linux, Firefox 85

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: