Hello, I’m trying just for testing to write on the database on a collection where the CLP permission is read only for public using a simple testing cloud function that I call from frontend.
This is the frontend code
const params = { name: "London" };
const nameChange = await Moralis.Cloud.run("testNameChange", params);
console.log(nameChange);
This is the cloud code
Moralis.Cloud.define("testNameChange", async (request) => {
const userAddress = request.user.get('ethAddress');
const query = new Moralis.Query("Cities");
query.equalTo("User", userAddress, 'i');
const cityItem = await query.first();
if (cityItem) {
cityItem.set("cityName", request.params.name);
cityItem.save({useMasterKey:true});
}
},{
requireUser: true
});
Console log seems working on the variables (it retrieves the correct row) but nothing is written in the database.
Where could be the issue?
Thank you