Description
I have performed a test migration of my Parse db and application to a self-hosted solution.
I have successfully authenticated my PFUser with parse-server with an iOS client.
NB :
I have successfully executed the hello example in main.js using curl to ensure that my parse server endpoint is correctly configured. I can also execute this from my iOS client code. So cloud-functions are working on the desired end-point.
However I am having problems in getting any of my cloud-code Query functions to execute properly.
Here is an example of a test function that has the problem.
Parse.Cloud.define("galleryForUser", function(request, response) {
var query = new Parse.Query("Gallery");
query.equalTo("username", "testuser");
query.useMasterKey = true;
query.find({
success: function(results) {
response.success("Success");
},
error: function(err) {
console.log(err);
response.error("gallery lookup failed");
}
});
});
This returns an error and prints the following to the console.log(err) call in the parse-server stdout
ParseError { code: undefined, message: 'unauthorized' }
I get this error when calling from inside an iOS app, after authenticating and ensuring that PFUser is valid, or just when calling with curl outside of an established session.
It is unclear to me why the code should be undefined or what is happening here.
Is this a defect or is there something wrong with my cloud code?
I have added the query.userMasterKey = true line having read that this was required in the migration docs. Adding or removing it seems to make no difference.