CYB*_*B3R 2 parse-platform parse-cloud-code
我正在运行parse-server并尝试创建一个解析云代码函数.我从这个过于简单的例子开始:
Parse.Cloud.define("createContent", function(request, response) {
response.error("not implemented");
});
Run Code Online (Sandbox Code Playgroud)
我可以使用带有curl的REST API调用我的函数并获取带有错误消息的JSON :( {"code":141,"error":"response.error is not a function"}这不是我期望的错误消息).经过进一步检查的response对象竟然是null.
这是日志的相应部分:
error: Failed running cloud function createContent for user undefined with:
Input: {}
Error: {"code":141,"message":"response.error is not a function"} functionName=createContent, code=141, message=response.error is not a function, , user=undefined
error: response.error is not a function code=141, message=response.error is not a function
Run Code Online (Sandbox Code Playgroud)
看起来您正在运行最新版本的服务器.请按照迁移指南进行操作:
https://github.com/parse-community/parse-server/blob/master/3.0.0.md
例如,现在你需要写:
Parse.Cloud.define("createContent", function(request, response) {
throw "not implemented";
});
// also valid
Parse.Cloud.define("createContent", function(request, response) {
throw new Error("not implemented");
});
// returning a rejected promise
Parse.Cloud.define("createContent", function(request, response) {
return Promise.reject("not implemented");
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
807 次 |
| 最近记录: |