【问题标题】:Parse-server Cloud Code Error 141 Invalid FunctionParse-server 云代码错误 141 无效函数
【发布时间】:2016-08-21 02:31:00
【问题描述】:

我在 Heroku 上运行 parse-server,我正在实现一个自定义的云代码函数,但是每个实现都返回无效的函数代码:141,版本:1.12.0

我已成功让“hello”功能正常工作,包括我对其进行的 1 项更改:

Parse.Cloud.define('hello', function(req, res) {
  console.log("received.........");
  res.success('Hi');
});

我正在尝试使用的自定义函数是对我的数据库的简单查询:

Parse.Cloud.define("titleQuery", function(request, response) {
  var query = new Parse.Query("StudentNotes");
  query.equalTo("title", request.params.title);
  query.find({
    success: function(results) {

      console.log("received........." + results);

      response.success(results);
    },
    error: function() {
      console.log("received........." + error);

      response.error("title lookup failed");
    }
  });
});

当我使用以下代码在 iOS 上运行它时:

        PFCloud.callFunctionInBackground("titleQuery", withParameters: ["title": "testTitle"]) {
          (response: AnyObject ? , error : NSError ? ) - > Void in
            let hello = response // as? String
          print(hello)

        }

我正在“StudentNotes”类中的数据库中查询名称为“testTitle”的对象标题,我知道该对象存在,但是由于它引发错误 141,我没有收到任何东西。任何帮助将不胜感激。

EDIT2:我已经获得了自定义云功能,但是我无法对我的数据库进行任何查询。 任何人都可以发布返回对象的确认工作查询吗?也许来自 _User 表,以便我可以复制/粘贴并确保我的云代码可以访问我的数据库?

我的过程: 我编辑 Main.js 文件并添加我的云功能。 然后我提交并推送(成功) 最后我重新启动了我的 Heroku 服务器 然后我仍然得到一个错误 141 无效函数返回

【问题讨论】:

    标签: ios swift parse-platform parse-cloud-code parse-server


    【解决方案1】:

    我已经成功解决了这个问题,并让常规查询正常工作。问题出在仪表板中的 Heroku 配置变量中。我的服务器 URL 无效,从未更改过默认值“http://yourappname.com/parse/”我必须手动输入“yourappname”。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-13
      • 2017-08-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-20
      相关资源
      最近更新 更多