Cleaning up nested promises in Cloud function
I'd start with refactoring the promises functions and remove any code repetition, something like this:

...

function success(object){
    // success                          
}
function error(error){
    return response.error(error);
}
...

query.find().then(function(array){
    if(array) {
        // found at least one object - take the first
        parseObject = array[0];        
        parseObject.set(dataObject);        
     } else {
        // nothing found - create new
        parseObject = new Class(dataObject);
     }    
     parseObject.save().then(success,error); 
});
...