首页 > 解决方案 > 解析云函数响应错误

问题描述

我为演示目的编写了这个云函数。

Parse.Cloud.define('hello', function(req, res) {
  res.success("hi");
});

但它总是返回此错误消息

{
    "code": 141,
    "error": "res.success is not a function"
}

怎么了?

标签: parse-platformparse-server

解决方案


从解析服务器 3.0 开始,不再有响应对象。只需返回该值,它就会起作用。

Parse.Cloud.define(‘hello’, (req) => {
     return ‘ok’;
});

有关更多信息,请参阅迁移指南:https ://github.com/parse-community/parse-server/blob/master/3.0.0.md


推荐阅读