Hello,
I am trying to save a json object in the IPFS from a cloud function, but I am getting the error " Error: {āmessageā:āfile.saveIPFS is not a functionā,ācodeā:141}".
What am I doing wrong? Is it possible to do it from a cloud function?
I know that would be better to do it in the client side, but in this case I can not trust in the client, so I need to do it in the cloud function.
Moralis.Cloud.define("saveMetadataForNFT", async (request) => {
var metadata = {
"name" : request.params.name,
"description": request.params.description,
"location": request.params.location
};
const jsonStr = JSON.stringify(metadata);
const data = Array.from(Buffer.from(jsonStr));
const file = new Moralis.File('metadata_'+request.params.name, data);
await file.saveIPFS();
return {
"ipfsLocation": "test"
};
});
Thanks,
Pedro