-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Cloud Code Guide Async Details Lacking #4668
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
Comments
Have you had a look in the cloud code guide? http://docs.parseplatform.org/cloudcode/guide/#getting-started I believe all the triggers are documented here. Feel free to open a pull request to the documentation repository (https://GitHub.com/Parse-community/docs) if your find those can be improved. |
I visited the cloud code guide maybe tens of times and also read every other resources online on cloud code. Even after that, it is not very straightforward how to implement async operations on cloud code triggers: my personal long experience on the issue and online questions show the lack of information on the issue. I can easily tell that there is less in the Cloud Code Guide than there should be. I myself would not choose to prepare a PR for this because I might have misunderstood some details even though the practices I adopted seem to work for now. Hence, I only wanted to point out the lacking and find out if anybody more involved with the Parse Server's way of handling triggers would be eager to discuss adding some examples to the guide. |
So please open a pull request or an issue on the docs repository. You are very vague in the description of the issue itself, therefore I don’t really know how to improve the docs. The docs are explicit about usage of response.success and response.error |
Hello,
This is a missing point in the Cloud Code Guide rather than being an issue, but I want to point this out so that people working on triggers and cloud functions can tackle things more hassle-free.
I sometimes see questions on StackOverflow and also here about the usages of cloud code triggers and mostly they are about not being explained on how to use async calls in those triggers. I myself had head-scratching times trying to figure out what was wrong with the triggers and had to dive deep into parse-server source code in the end.
Solution for those problems generally lies in understanding what the triggers expect in case of async calls. Some of them can work only if you to return your main promise (if there is more inside, chain the returns) , some other expect you to resolve your own promises in the trigger function and call response.success() or response.error(), and some do not really expect anything back.
What I see is, these different requirements are not reflected to the cloud code guide in detail and people have not-affecting-anything trigger functions which do not complain and they do not understand what is wrong with their implementations, naturally. I, myself, cannot make sure my cloud functions and triggers (which I use a loot) do not leave hanging promises although I worked them a lot and tried to understand how Parse Server handles the responses.
So, the point is:
It would be really beneficial and painless for us folks if anybody had some more insight on how well-working and efficient async cloud code functions and triggers can be written and added those to the Cloud Code Guide.
The text was updated successfully, but these errors were encountered: