Closed ikarelin closed 2 years ago
Unauthorized error
Maybe the user is not allowed to execute the query? You could try using useMasterKey: true
when executing the query. I suggest to simplify the code example and remove everything that is not necessary to reproduce the issue. If you could provide a complete example in form of a failing test (see /spec
folder) we can look into this issue. Otherwise it's difficult to analyze because we cannot see which object and class level permissions you have set.
Parse.Cloud.afterSave("Bookings", (request) => {
const postingID = request.object.get('postingID');
const CurrentPosting = Parse.Object.extend("Postings");
const postingQuery = new Parse.Query(CurrentPosting);
postingQuery.get(postingID).then((currentPosting) => {
// The posting retrieved
console.log('*** Posting retrieved !!!');
}, (error) => {
// The posting was not retrieved
console.log('*** Error retreiving posting for booking !!!', error);
});
});
useMasterKey: true is fixed an issue.
New Issue Checklist
Issue Description
I have created a simple Parse Cloud function and want to query an object.
Steps to reproduce
Just run the code
Actual Outcome
Unauthorized error
Expected Outcome
Expected a Parse Object
Environment
Server
4.10.4
Debian Buster
Digital Ocean
Database
MongoDB
5.0.5
Own Server
Client
JavaScript
Unknown
Logs