0
votes

The code does basically does what it is supposed to do which is to update the User table by turning a boolean column true for a Parse object. When it does this though two unexpected things happen:

1) It returns the aforementioned error: code: 141, message: "success/error was not called". From what I can tell I am calling success and error?!?

2) It saves success and error objects in the User table, which I have no idea how that happens.

My cloud code:

Parse.Cloud.define("activate", function(request, response){
  Parse.Cloud.useMasterKey();

  var user = new Parse.Query(Parse.User);
  user.get(request.params.id, {
    success: function(User){
      User.set("vendorAgreement", true);
      User.save({
        success: function(saved){
          response.success(saved);
        },
        error: function(saved, error){
          response.error(error);
        }
      });
    }
  })
});
1

1 Answers

1
votes

The key here is to include 'null' in your object.save(). Code that works looks like:

Parse.Cloud.define("activate", function(request, response){
  Parse.Cloud.useMasterKey();

  var user = new Parse.Query(Parse.User);
  user.get(request.params.id, {
    success: function(User){
      User.set("vendorAgreement", true);
      User.save(null, {
        success: function(saved){
          response.success(saved);
        },
        error: function(saved, error){
          response.error(error);
        }
      });
    }
 })
});