Search code examples
iosswiftparse-cloud-codeparse-server

Parse Server Cloud Code Query Syntax Error 141


I cannot for the life of me get a Parse-server Query to work using cloud code... I simply want to retrieve an object from my mLabs database. I am running prase server on Heroku with the database on mLabs. Currently any attempt to query results in error 141 and the query fails. The code I have been attempting to use to query 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({
       //Parse.Cloud.useMasterKey();, //THIS LINE CAUSES SERVER CRASH
       useMasterKey: true,
       success: function(results){
        //console.log("received " + results.length + " result(s)");
          response.success("done" + results);
       },
       error: function(error) {
        //error
         response.error("FAILED test Function " + error); //THIS GETS CALLED
       }
     });
});

This query should go into my StudentNotes table and retrieve all notes with the displayName "Billy" However this query fails and I know for a fact that it should return something.

I can successfully call the custom function, it just replies with my

response.error("FAILED test Function " + error); //THIS GETS CALLED

Can someone please help me figure out why my simple query is not working? Maybe suggest what I should change or supply me with working code for a simple cloud code query for testing purposes?


Solution

  • I have successfully solved this problem and gotten regular queries to work. The problem was in my Heroku config vars in the dashboard. My server URL was invalid, never changed from the default of "http://yourappname.com/parse/" I have to manually enter "yourappname".