Hello,
I’m trying to follow this “https://docs.moralis.io/files#server-side” and save a file in a cloud function.
I’m basically constructing a JSON file and doing some tests, when I call the cloud function it gives me the following error:
Error: File upload by public is disabled.
Here is my full code:
const logger = Moralis.Cloud.getLogger();
Moralis.Cloud.define("saveDataToFile", async (request) => {
  logger.info("saveDataToFile called..."); 
  
  const msg = '{"name":"John", "age":"22"}';
  const jsonObj = JSON.parse(msg);
  const jsonStr = JSON.stringify(jsonObj);
  const data = Array.from(Buffer.from(jsonStr));
  const contentType = "application/json; charset=UTF-8";
  const file = new Moralis.File('datafile1', data, contentType);
  await file.save();
  fileURL = file.url();
  
  logger.info(`fileURL ${fileURL}`);
  
  return {
  	dataUrl: fileURL,
    dataHash: 'hash'
  };
});
Does my account need some special permission to do this?
Thanks,
 
      
    