Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parse: ParseError { code: 101, message: 'Object not found.' }

I have a cloud function running some code like this and I am able to get a response for my query which is a valid class instance, but when I try to update the instance with the set method, I get the error you see in the title.

async function addToDB(apiKey) {
    const query = new Parse.Query(MyClass);
    query.equalTo('apiKey', apiKey);
    const response = await query.find({ useMasterKey: true });
    const myInstance = response[0];
    myInstance.set('total', 100);
    try {
        await myInstance.save({ useMasterKey: true });
    } catch (e) {
        console.log('E', e);
    }
}
like image 223
sdfsdf Avatar asked Apr 19 '26 06:04

sdfsdf


1 Answers

the options parameter ( { useMasterKey : true}) should be the second parameter passed to save

the first parameter to a save should be a null, i.e. :

myInstance.save(null, { useMasterKey: true })

in essence, you are not passing the masterkey option in to the save call - which is why you are getting the 101 error (in my experience, a 101 is almost always related to permissions issues!)

see more here http://parseplatform.org/Parse-SDK-JS/api/v1.11.1/Parse.Object.html#save

like image 192
simonberry Avatar answered Apr 20 '26 21:04

simonberry



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!