Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server side call to async method returns Promise object, not value. #8367

robfallows opened this issue Feb 14, 2017 · 4 comments


Copy link

Refer to this post on the Meteor forums and to @benjamn's comments which follow on.

In a nutshell, a 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:


git clone promise-issue
cd promise-issue
meteor npm i

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
@benjamn benjamn self-assigned this Feb 14, 2017
Copy link

I'm seeing this as well.

Copy link

Suppen commented Mar 14, 2017

As a workaround, I exported the method function and imported it where I was using it on the server (in another method), then used to get the correct context

@benjamn benjamn added this to the Release 1.4.3.x milestone Mar 16, 2017
benjamn added a commit that referenced this issue Mar 16, 2017

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.
Copy link

benjamn commented Mar 17, 2017

This issue should (finally!) be resolved if you run meteor update --release in your application directory, thanks to the commit 0cbd251 referenced above.

Copy link
Contributor Author

Works like a charm - thank you @benjamn 👍

@abernix abernix modified the milestones: Release 1.4.3.x, Release Mar 21, 2017
@abernix abernix added the fixed label Mar 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

5 participants