I'm trying to get this cloud code function working but I keep getting the following error:
code: 141, message: "success/error was not called"
I'm definitely passing in the correct request object so that is not an issue. Everything should save correctly but it doesn't seem to like how I'm calling success/error.
Here is my code:
Parse.Cloud.define("redeemedCustomers", function(request, response) {
Parse.Cloud.useMasterKey();
console.log(request.params.consumersToUpdate);
console.log(request.params.sref);
_.each(request.params.consumersToUpdate, function (b) {
var Referred = Parse.Object.extend("User");
var referralQuery = new Parse.Query(Referred);
referralQuery.equalTo("objectId", b);
referralQuery.first().then(function(newbie){
console.log(newbie);
newbie.set("ref", request.params.sref);
newbie.save({
success: function () {
response.success("Credits were given.");
},
error: function (error) {
response.error(error, "Credits were not given.");
}
});
})
})
})