Meteor.setTimeout behaving differently on client and server. TypeError: Cannot assign to read only property '_onTimeout'

I have some strange issue with timers. I’m trying to clear a timeout I set with Meteor.setTimeout.

One issue is that if I do the following on the client and server I get different results:

    `console.log(Meteor.setTimeout(function () {}, 100));`

On the server it returns a complex object. On the client it returns a Number. Is this the expected behaviour?

The following test code is working for me on the server it seems:

        const handle = Meteor.setTimeout(function () {}, 100);

But when I do the following:


where this.timeouts[someId] is a timeout handle.

I get the following error:

[TypeError: Cannot assign to read only property '_onTimeout' of BqKqXDcdbDhGP7YKp]

Any idea why this happens or how to fix it?

Having done a bunch of tests what I’m trying to do works when I do this:


    const handles = {};
    handles['abc'] = Meteor.setTimeout(function () {}, 1000);

    console.log('HANDLE CLEARED');

But isn’t working for the code I want it to work on. Any ideas why this error is appearing for me?
[TypeError: Cannot assign to read only property '_onTimeout' of BqKqXDcdbDhGP7YKp]