Hey o/, iām tryng to make one validation in cloud code and edit an object but iām getting the response: object not found.
The query return he value but is not saving.
This is my code:
Moralis.Cloud.define("cancelAuction", async (request) => {
const auctionId = request.params.auctionId;
const auctionClass = Moralis.Object.extend("Auction");
const queryAuction = new Moralis.Query(auctionClass);
queryAuction.equalTo('objectId', auctionId);
queryAuction.include('lastValidTransaction');
let auction = await queryAuction.first();
if(!auction) {
throw "Auction not found"
}
if(auction.get('lastValidTransaction').get('action') === 2) {
auction.set('status', 4)
return await auction.save()
}
throw "Auction already have an interaction";
});
I saw that when i use the master key it works. When looking for the ACL permissions the current user of the request have permission to write that object.