I am trying to run the following parse background job in Cloud Code
Parse.Cloud.job(\"sendAlert\", function(sendAlert) {
Parse.Push.send({
data:
If you look for the word status
in your code, you will see that you haven't declared it anywhere. A variable named status
can't just come out of nowhere, so that's why you're getting a ReferenceError.
According to the documentation, the second parameter passed into the Parse.Cloud.job()
callback is a JobStatus
object with error
and success
methods, so it seems that's what you're trying to use:
// declare it here ---------v
Parse.Cloud.job("sendAlert", function(sendAlert, status) {
Parse.Push.send({
data: {
"content-available": 1,
}
}, {
success: function() {
status.success("Push Worked!!!");
},
error: function(error) {
status.error("Uh oh, something went wrong.");
}
});
});