I’ve just changed the permission of CLP to read only for a collection that is populated from a contract sync event.
On this collection I’ve a beforeSave to add more fields once the row is created.
I do some “set” like
request.object.set("playerName", player.get("name"));
I’m receiving an error from the console like this
2022-05-31T14:44:24.268Z - Error: Permission denied for action update on class TokenSalesStatus.
at Function.validatePermission (/moralis-server/lib/Controllers/SchemaController.js:1512:11)
at SchemaController.validatePermission (/moralis-server/lib/Controllers/SchemaController.js:1517:29)
at /moralis-server/lib/Controllers/DatabaseController.js:542:63
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Since is a permission error, how can I save with the masterkey in a newly created row in the collection?
I’m saving at the end of the “set” like this with the master key, but it seems not working
request.object.save(null, {useMasterKey:true});
Thank you