I get this error
error: Failed running cloud function testGetAllUsers for user undefined with:
Input: {}
Error: {"message":"Validation failed. Please login to continue.","code":142} {"error":{"code":142,"message":"Validation failed. Please login to continue."},"functionName":"testGetAllUsers","params":{}}
when I try to run this code:
Parse.Cloud.define("testValidation", async (request) => {
const result = await Parse.Cloud.run("testGetAllUsers", {});
return ressult
});
where testGetAllUsers is
Parse.Cloud.define("testGetAllUsers", async (request) => {
const { params, user } = request
// Create User class instance
const userClass = Parse.Object.extend(Parse.User);
try {
const userQuery = new Parse.Query(userClass);
userQuery.includeAll()
return await userQuery.find({ useMasterKey: true });
} catch(error) {
throw error;
}
}, {
requireUser: true
});
So basically, when I run testGetAllUsers itself, everything is fine. It sees the User who’s logged in. However, whenever I call one function who has requireUser: true from another function, I get the error mentioned above.
Is there way to pass the user to the nested function?