beforeDelete problem
Scenario:
- I have created a object via client successfully.
- Destroy of that object was also successful via client.
- But when I use
Parse.Cloud.beforeDelete("MyClass", function(request){
console.log("Before delete EXECUTED");
});
then the destroy of that object is not possible. 4. In the console it is printed "Before delete EXECUTED" but the destroy operation from client gives error.
p.s: my server is running in heroku and database is hosted in mongolabs.
Hi,
this is the signature of the beforeDelete trigger
Parse.Cloud.beforeDelete("MyClass", function(request, response) {
// your code here
response.success(); // do not forget to call response.success() to allow the deletion of your object
});
It seems that you forgot to call response.success(). You have to call it into beforeDelete to allow parse-server to delete your object.
If you want to stop the deletion, you can call response.error(). For example, if the delete operation is not authorized for the user who called it.
Hope it helps.
Thanks Kira2. I totally missed that. Thanks a lot.