Description
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.