Meteor method timing out in cypress


We’re running our end-to-end tests with cypress and we added this little helper to run methods from our tests directly:

Cypress.Commands.add('getMeteor', () =>
  cy.window().then(({ Meteor }) => {
    if (!Meteor) {
      // We visit the app so that we get the Window instance of the app
      // from which we get the `Meteor` instance used in tests
      return cy.window().then(({ Meteor: MeteorSecondTry }) => MeteorSecondTry);
    return Meteor;

Cypress.Commands.add('callMethod', (method, ...params) => {
    name: 'Calling method',
    consoleProps: () => ({ name: method, params }),

  cy.getMeteor().then(Meteor =>
    new Cypress.Promise((resolve, reject) => {
        (err, result) => {
          if (err) {


// Use it like this for example
beforeEach(() => {

The issue we have, is that sometimes this never returns, i.e. the callback is never fired, even though on the meteor server, the code has been executed and the method has reached the end without errors.

It only happens for one specific method. I moved it to be server-only which made it run fine a few times, then it didn’t work again. I tried to use Meteor.apply and play around with the options which helped for a few runs and then it started failing again.

I really have no idea what I can try, which package might be causing some kind of error to be swallowed, or whatever else might be happening.

When a meteor method finishes executing, what happens next? Who/what could be preventing the callback from being fired?