objective c - Parse Cloud Code query not getting executed -


i have below cloud code function , when call function os x app, success response well. none of console log output messages inside success , failure blocks of query operation gets executed. ideas on appreciated.

parse.cloud.define("markalertasexpired", function(request, response) {    parse.cloud.usemasterkey();   var alert = parse.object.extend("alert");   var query = new parse.query(alert);   query.get("vc6ppoxuqd", {     success: function(alertobj) {       // object retrieved successfully.       var status = alertobj.get("status");       console.log("received object status:");       console.log(status);       if (status == "active") {         console.log("active");         markactivealertasexpired(alertobj);       } else if (status == "inactive") {         console.log("inactive");         markinactivealertasexpired(alertobj);       } else {         console.error("unknown_status");       }     },     error: function(object, error) {       // object not retrieved successfully.       // error parse.error error code , message.       console.error("alert_not_found");       response.error("alert_not_found");     }   });    response.success("available"); }); 

you need wait queries complete before calling response.success, updated code below should work.

parse.cloud.define("markalertasexpired", function(request, response) {    parse.cloud.usemasterkey();   var alert = parse.object.extend("alert");   var query = new parse.query(alert);   query.get("vc6ppoxuqd", {     success: function(alertobj) {       // object retrieved successfully.       var status = alertobj.get("status");       console.log("received object status:");       console.log(status);       if (status == "active") {         console.log("active");         markactivealertasexpired(alertobj);       } else if (status == "inactive") {         console.log("inactive");         markinactivealertasexpired(alertobj);       } else {         console.error("unknown_status");       }       response.success("available");     },     error: function(object, error) {       // object not retrieved successfully.       // error parse.error error code , message.       console.error("alert_not_found");       response.error("alert_not_found");     }   });   }); 

Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -