This used to work for me until today…
const crypto = require('crypto');
const logger = Moralis.Cloud.getLogger();
Moralis.Cloud.define("saveSellerDataToFile", async (request) => {
logger.info("saveSellerDataToFile called...");
const sellerData = request.params.sellerData;
const dataHash = crypto.createHash('sha256').update(sellerData).digest('hex');
return {
dataHash
};
});
But today the function fails with…
TypeError: require is not a function
I’ve also tried import
but it also does not work.
How to use the default node.js modules like crypto in my cloud functions?