title: Do promises mess up functioning of Parse cloud functions?
body: <p>Trying to debug some strange behavior in my Parse cloud functions.</p>
  
  <p>I've been wondering if cloud functions that are expecting response.success() or response.error() to be called are guaranteed to wait until promises are resolved/error. </p>
  
  <p>Here's an example: </p>
  
  <pre><code>Parse.Cloud.define("my_cloud_function", function(request, response) {
    myFunctionThatReturnsAPromise().then(function(msg) {
      msg = typeof msg !== 'undefined' ? msg : "";
      response.success(msg);
    }, function(error) {
      var message = typeof error.message !== 'undefined' ? error.message : "";
      response.error(message);
    });
  });
  </code></pre>
  
  <p>This cloud function reaches the end of its execution before myFunctionThatReturnsAPromise() actually returns its promise and executes one of its then blocks. <strong>Timeout aside, is my_cloud_function going to reliably set up the delivery of calls using the response object even after it finishes execution?</strong> </p>
  
  <p>It certainly seems like this is what I observe, but I'm not positive this behavior is guaranteed to happen consistently. </p>