Possible cause for "TypeError: handle.stop is not a function"

Hi all,

finally got to upgrade my app to meteor 3.0 beta. Needed to change quite a few bits but overall it looks fine.

I just get several errors in the log like this one

Exception in onStop callback: TypeError: handle.stop is not a function
    at OplogObserveDriver._stop (packages/mongo/oplog_observe_driver.js:966:20)
    at OplogObserveDriver.stop (packages/mongo/oplog_observe_driver.js:971:12)
    at ObserveMultiplexer._stop (packages/mongo/observe_multiplex.js:85:5)
    at ObserveMultiplexer.removeHandle (packages/mongo/observe_multiplex.js:72:7)
    at ObserveHandle.stop (packages/mongo/observe_multiplex.js:230:5)
    at Subscription.<anonymous> (packages/mongo/collection.js:588:14)
    at Subscription.<anonymous> (packages/meteor.js:1350:19)

I noticed that a myCollection.find({...}).observe({...}) now returns a Promise, so I changed all my custom pubs accordingly. However I still get those errors and the stack traces are not really helpful. Someone got a clue?

Oh, yes. I came across that one also the hard way in reywood:publish-composite and our own internal code. Someone has also opened an issue: [Meteor 3] Mongo.Cursor.observeChanges returns a Promise instead of a query handle · Issue #12918 · meteor/meteor · GitHub

Not sure if this is an issue in itself, or an undocumented API change, but I guess it doesn’t hurt for now to just await the handle and see what Meteor Software does about it.

TL;DR This only happens on the server, on the client it is sync, just as everything else.