我已经部署了以下Parse Cloud Code:
Parse.Cloud.define("hello", function(request, response) {
response.success("Hello world! " + (request.params.a + request.params.b));
});
当我执行以下cURL命令时,这可以正常工作
curl -X POST
-H "X-Parse-Application-Id: {APP_ID}"
-H "X-Parse-REST-API-Key: {API_KEY}"
-H "Content-Type: application/json"
-d '{"a":"Adventurous ", "b": "Parser"}'
https://api.parse.com/1/functions/hello
然后我部署了以下代码来创建一个对象:
Parse.Cloud.define("addObject", function(request, response) {
var MyObject = Parse.Object.extend("myclass");
var myObject = new MyObject();
myObject.set('type', 'cloud');
myObject.save(null, {
success: function(myObject) {
response.success("saved the object");
},
error: function(myObject, error) {
response.error("didn't save the object. Error=" + error.message);
}
});
});
当我运行以下cURL命令时:
curl -X POST
-H "X-Parse-Application-Id: {APP_ID}"
-H "X-Parse-REST-API-Key: {API_KEY}"
-H "Content-Type: application/json"
-d '{"a":"Super Adventurous ", "b": "Parser"}'
https://api.parse.com/1/functions/addObject
记录以下错误:
E2015-11-07T08:13:19.227Z]vWEB Ran cloud function addObject with:
Input: {}
Result: Invalid webhook response status: 500 Internal Server Error
非常感谢任何帮助!