-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Description
I am using Heroku and mLabs with parse server. My issue is that whenever I try to call a custom cloud code function that simply queries my database I get the following error:
2016-04-27 00:20:33.037 socialStudy[72482:37569786] [Error]: Invalid function. (Code: 141, Version: 1.12.0)
The function being called is as follows:
Parse.Cloud.define("test", function(request, response) {
var ratingQuery = Parse.Object.extend("StudentNotes");
var query = new Parse.Query(ratingQuery);
query.equalTo("displayName","Billy");
query.find({
useMasterKey: true,
success: function(results){
//console.log("received " + results.length + " result(s)");
response.success("done" + results);
},
error: function(error) {
//error
response.error("failed to add 1 to parse cloud code rating. " + error);
}
});
});
The response is the error message noted above.
The code being used to call Parse cloud code in my ios app in swift is:
PFCloud.callFunctionInBackground("test", withParameters: ["":""]) {
(response: AnyObject?, error: NSError?) -> Void in
let hello = response// as? String
print(hello)
}
Why do I keep getting error 141? I have tried TONS of cloud code functions that query my database and I cannot get any of them to work.
NOTE: I have successfully called the "hello" function and that works fine.
I am beginning to think that there is some problem accessing my database in specific. At first I thought there was something wrong with the actual syntax of my function, if anyone can confirm that it is indeed correct that may be helpful, I am convinced that the syntax is correct, but having never gotten a function querying the database in cloud code to work I cannot be sure myself.