簡體   English   中英

解析服務器雲代碼錯誤 141 無效函數

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

我在 Heroku 上運行解析服務器,我正在努力實現自定義雲代碼功能,但是每個實現都返回無效的功能代碼: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 invalid function return

我已經成功地解決了這個問題,並讓定期查詢工作。 問題出在儀表板中的 Heroku 配置變量中。 我的服務器 URL 無效,從未更改過“ http://yourappname.com/parse/ ”的默認值 我必須手動輸入“yourappname”。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM