简体   繁体   English

解析服务器云代码错误 141 无效函数

[英]Parse-server Cloud Code Error 141 Invalid Function

I am running parse-server on Heroku, I am working on implementing a custom cloud code function, however every implementation returns invalid function code: 141, Version:1.12.0我在 Heroku 上运行解析服务器,我正在努力实现自定义云代码功能,但是每个实现都返回无效的功能代码:141,版本:1.12.0

I have successfully gotten the "hello" function to work, including 1 change I made to it:我已经成功地让“hello”功能正常工作,包括我对它所做的 1 处更改:

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

The custom function I am trying to get working is a simple query to my database:我尝试使用的自定义函数是对我的数据库的简单查询:

 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"); } }); });

When I run this on iOS with the following code:当我使用以下代码在 iOS 上运行它时:

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

I am querying my database in class "StudentNotes" for object title with the name "testTitle", I know for a fact that that object exists, however due to it throwing error 141 I do not receive anything.我在“StudentNotes”类中的数据库中查询名称为“testTitle”的对象标题,我知道该对象存在的事实,但是由于它抛出错误 141,我没有收到任何信息。 Any help would be greatly appreciated.任何帮助将不胜感激。

EDIT2: I have gotten custom cloud functions to work, however I cannot get any queries to my database to work. EDIT2:我已经获得了自定义云函数的工作,但是我无法对我的数据库进行任何查询。 Can anyone post a confirmed working query that returns an object?任何人都可以发布返回对象的确认工作查询吗? Perhaps from the _User table so that I can copy/paste and ensure that my cloud code can access my database?也许来自 _User 表,以便我可以复制/粘贴并确保我的云代码可以访问我的数据库?

My process: I edit the Main.js file and add in my cloud function.我的过程:我编辑 Main.js 文件并添加我的云函数。 Then i commit & push (successfully) finally i restart my Heroku server Then i still get an error 141 invalid function return然后我提交并推送(成功)最后我重新启动我的 Heroku 服务器然后我仍然收到错误 141 invalid function return

I have successfully solved this problem and gotten regular queries to work.我已经成功地解决了这个问题,并让定期查询工作。 The problem was in my Heroku config vars in the dashboard.问题出在仪表板中的 Heroku 配置变量中。 My server URL was invalid, never changed from the default of " http://yourappname.com/parse/ " I have to manually enter "yourappname".我的服务器 URL 无效,从未更改过“ http://yourappname.com/parse/ ”的默认值 我必须手动输入“yourappname”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM