Search code examples
iosswiftparse-cloud-codeparse-server

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
  • I can successfully call the 'hello' cloud code function
  • 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:

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
  • Push Change to git
  • Restart Heroku Server
  • Run App & Call cloud code from iOS app in Swift

Result: Every Time I get error 141 Invalid Function, however I can call 'hello' successfully. Just not a custom function.

Edit 2: I have discovered that I am unable to update any cloud functions. 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. 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


Solution

  • 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. 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.