简体   繁体   English

解析服务器云代码不起作用

[英]Parse Server Cloud Code Does Not Work

Hey guys I have a very confusing issue at hand, I want to state that I have looked through EVERY resource I could find including on here about getting custom cloud code functions to work. 大家好,我手头有一个非常令人困惑的问题,我想指出的是,我已经浏览了我可以找到的所有资源,其中包括如何使自定义云代码功能正常工作。

  • I am hosting Parse Server on Heroku with my database on mLabs 我在Heroku上托管Parse Server,并在mLabs上托管数据库
  • I can successfully call the 'hello' cloud code function 我可以成功调用“ hello”云代码功能
  • I cannot successfully call any custom Function, even one that prints something to the console 我无法成功调用任何自定义函数,即使是将某些内容打印到控制台的函数

Below is my current process that I have been using trying to get my cloud code functions to work 以下是我目前正在尝试使我的云代码功能正常运行的过程

  • Open Main.js and Add Cloud code: 打开Main.js并添加Cloud代码:

 Parse.Cloud.define('testParagraph', function(req, res) { console.log("received......... this is a console log for a test function that will print out a paragraph as a test"); res.success('Hi, this is the start of a new test function that will print out a paragraph'); }); 

  • Commit change to git 将更改提交到git
  • Push Change to git 将更改推送到git
  • Restart Heroku Server 重新启动Heroku Server
  • Run App & Call cloud code from iOS app in Swift 在Swift中通过iOS应用运行App&Call云代码

Result: Every Time I get error 141 Invalid Function, however I can call 'hello' successfully. 结果:每次我收到错误141无效函数,但是我可以成功调用“ hello”。 Just not a custom function. 只是不是自定义函数。

Edit 2: I have discovered that I am unable to update any cloud functions. 编辑2:我发现我无法更新任何云功能。 Meaning that while I can successfully call the "hello" function if I make a change to said function, re-upload to git, restart Heroku the change is not implemented. 这意味着,如果我对上述函数进行了更改,那么我可以成功调用“ hello”函数,然后重新上传至git,然后重新启动Heroku,则该更改未实现。 This leads me to believe that there must be something wrong with either the link to my main.js or it is being uploaded somewhere else and isnt calling the correct main.js... Any insight would be helpful 这使我相信,指向main.js的链接肯定有问题,或者它被上传到其他地方,并且没有调用正确的main.js ...任何见解都会有所帮助。

I solved this issue, my git was behind HEAD and therefore any changes I made did not become active on my Heroku Server, I merged my branches and this solved my problem of not being able to run custom functions. 我解决了这个问题,我的git落后于HEAD,因此我所做的任何更改都未在Heroku Server上激活,合并了分支,这解决了我无法运行自定义功能的问题。 Now I am able to run custom functions, but I still get error 141 when try to query my database, due to the new problem I am marking this as solved and asking a new question. 现在,我可以运行自定义功能,但是由于新问题,我仍在尝试查询数据库时仍然出现错误141,我将其标记为已解决并提出了新问题。

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

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