You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refer to this post on the Meteor forums and to @benjamn's comments which follow on.
In a nutshell, a Meteor.call done on the server does not get the return value of an async method. Instead, it gets the Promise object. This is at variance with the expected behaviour.
This has been observed since v1.3, but the reproduction uses v1.4.2.6:
Reproduction:
git clone https://github.com/robfallows/promise-issue promise-issue
cd promise-issue
meteor npm i
meteor
The server's console log shows the result of calling the async method (shows {} - expected "42"):
I20170214-11:23:14.415(0)? The answer to the ultimate question of life, the universe and everything is ... {}
The client browser shows the result of calling the async method from the client (shows "42" as expected):
The answer to the ultimate question of life, the universe and everything is ... 42
The text was updated successfully, but these errors were encountered:
As a workaround, I exported the method function and imported it where I was using it on the server (in another method), then used method.call(this) to get the correct context
…ods.
This is a partial revival of my old #5005 pull request. While we never
came up with a good idiom for Promise-based method stubs on the client,
the server-side changes in this commit should fix#8367.
This issue should (finally!) be resolved if you run meteor update --release 1.4.3.3-beta.4 in your application directory, thanks to the commit 0cbd251 referenced above.
Refer to this post on the Meteor forums and to @benjamn's comments which follow on.
In a nutshell, a
Meteor.call
done on the server does not get the return value of an async method. Instead, it gets the Promise object. This is at variance with the expected behaviour.This has been observed since v1.3, but the reproduction uses v1.4.2.6:
Reproduction:
The server's console log shows the result of calling the async method (shows
{}
- expected "42"):The client browser shows the result of calling the async method from the client (shows "42" as expected):
The text was updated successfully, but these errors were encountered: