Stitch instance "died" on us

Hello,

Yesterday we had to experience an unexpected failure of our Stitch application/instance. We have reached out to support, but they cannot help since we are not on one of the premium support plans. Hopefully someone here has any suggestions that might help us prevent this from happening in the future.

The instance has been running fine since december 2019 (so about 6 months). Basically it only provides us an easy access point to 2 collections from a web interface using the Stitch JavaScript SDK. A great way to build an application quickly without all the hassle of maintaining servers and such.
The application does some basic operations such as search and update. These were also never giving any troubles. In the past days however we were seeing an increased number of errors in a very important part of the application which keeps some important info on the main screen of our application up-to-date, using the collection.watch() function (aka a Change Stream). This particular function gave more and more errors “Origin https://myorigin is not allowed by Access-Control-Allow-Origin.” (also reported in this topic).

We have been trying to solve this. Most likely cause (besides something really wrong with CORS, whcih we obviously checked first) is a problem with the ChangeStream count. To mitigate this we renamed the collection and then set it back to the original name, whcih should force all open Change streams to close. But it did not help.

Yesterday afternoon the browsers started to receive an error “429 Too Many Requests”. And the Stitch instance “died”. When looking at the Atlas Stitch Admin page we see a 404-error for the instance. It cannot be restarted or anything, just deleted.

To be able to quickly continue our normal work we have meanwhile re-created the Stitch instance/application and point our browsers to that locations. But obviously we would like to prevent this from happening again.

I hope somenone can point out where the problem might be so we can fix this.

Kind regards,
Leo

For those who wonder, this is the (textbook) code for the collection.watch() bit:

var ChangeStream = false;
async function watcher() {
    // see https://docs.mongodb.com/stitch-sdks/js/4/interfaces/remotemongocollection.html#watch
    if (typeof(ChangeStream.isOpen) === 'function' && ChangeStream.isOpen()) {
        ChangeStream.close();
    }
    // Create a change stream that watches the collection
    try {
        ChangeStream = await jobsCollection.watch([]); 
    } catch (e) {
        console.log(e);
        watcher(); //re-init
    }
    ChangeStream.onError((e) => {
        watcher(); //re-init
    });
    ChangeStream.onNext((event) => {
        if (app) app.updateOrder(event);
    });
};

Leo