Description
After upgrading from Meteor v2.11.0 to v2.12.0, the Meteor.call
with a callback function is not working asynchronously on the server as expected.
Expected Behavior
The console logs order should be:
testAsync2 called
testAsync2 finished
true
Actual Behavior
The console logs order on v2.12.0 is:
testAsync2 finished
testAsync2 called
true
Steps to Reproduce
- Upgrade Meteor from v2.11.0 to v2.12.0
- Use the following Meteor methods:
'ownUser.testAsync': function testAsync() {
Meteor.call('ownUser.testAsync2', (error, response) => {
if (error) { throw new Meteor.Error(error); }
console.log(response);
});
console.log('testAsync2 called');
},
'ownUser.testAsync2': async function testAsync2() {
// eslint-disable-next-line no-promise-executor-return
const response = await new Promise((resolve) => setTimeout(() => resolve(true), 5000));
console.log('testAsync2 finished');
return response;
},
- Observe the console logs order
Workaround
Reverting back to Meteor v2.11.0 resolves the issue.