The problem is async requests. You do not wait for the request to complete before calling response.success().
Think about what you are calling in firstPhoneNumberQuery.find(), for example, putting eggs in a boil, blocks successand error- this is what you will do when it is done.
response.success() , , , , "".
promises, , response.success() success :
duplicationQuery.count({
}).then(function() {
var firstPhoneNumberQuery = new Parse.Query(PhoneNumbersObject);
firstPhoneNumberQuery.equalTo('user', Parse.User.current());
return firstPhoneNumberQuery.find();
}).then(function(results) {
response.success();
}, function(error) {
});
, then().
promises :
https://parse.com/docs/js_guide#promises