javascript - parse.com "error: unauthorized" when trying to save object -
i using masterkey yet still getting unauthorized error when trying save object. can figure out why? can see "started making ticket" gets logged. , request.params pull correct information.
also, side question...i under impression if response.error executed stops code, send error message function called cloud code , run error handling there. have console.log error message in cloud code, , error alert in function called it. getting console log show, not alert. assumption wrong in doesnt passed, , terminates entire thing upon executing response.error?
parse.cloud.define("createrecord", function(request, response) { var caseclass = parse.object.extend("cases"); var ticket = new caseclass(); console.log("started making ticket"); ticket.title = request.params.title; ticket.category = request.params.category; ticket.priority = request.params.priority; ticket.description = request.params.cmnts; ticket.save(null, {usemasterkey: true}).then(function() { response.success(); }, function(error) { response.error("error response: " + error.message); });
try this:
parse.cloud.run("createrecord", {something: yourdata}, {...
and:
parse.cloud.define("createrecord", function (request, response) { var = request.params.something; var caseclass = parse.object.extend("cases"); var ticket = new caseclass(); console.log("started making ticket"); ticket.set("title", something.title); ticket.set("category", something.category); ticket.set("priority", something.priority); ticket.set("description", something.cmnts); ticket.save(null, {usemasterkey: true}).then(function() { response.success(); }, function(error) { response.error("error response: " + error.message); });
Comments
Post a Comment