meteor/meteor

Upgrading to Meteor 2.8 brakes brackend

Open

#12311 opened on Nov 18, 2022

View on GitHub
 (8 comments) (0 reactions) (0 assignees)JavaScript (44,781 stars) (5,257 forks)batch import
Impact:fewgood first issueidlemissing-docs

Description

We've been using Meteor in production for about 4 years in 3 separate projects and when we upgraded to meteor 2.8 we started noticing the same behavior across all projects.

For some reason which we dont understand when we upgrade to meteor 2.8 the backend starts running asynchronous instead of synchronous, which is not usual for node.

A quick example:

If I run

   if (Meteor.isServer) {
    Meteor.methods({
	    someMethod1: async () => {
		    await new Promise(resolve => {
			    setTimeout(() => { resolve() }, 3000)
		    })

		    return "done"
	    }, 
	    someMethod2: async () => {

		    await new Promise(resolve => {
			    setTimeout(() => { resolve() }, 1000)
		    })

		    return "done"
	    },
	    someMethod3: async. () => {

		    await new Promise(resolve => {
			    setTimeout(() => { resolve() }, 100)
		    })

		    return "done"
	    },
    })
  }

function MyComponent() {
	Meteor.call("someMethod1", () => {
		console.log("method 1 done")
	})

	Meteor.call("someMethod2", () => {
		console.log("method 2 done")
	})

	Meteor.call("someMethod3", () => {
		console.log("method 3 done")
	})
}

**Expected Output** 
method 3 done
method 2 done
method 1 done

**Actual Output**
method 1 done
method 2 done
method 3 done

`

Contributor guide