I tried to execute a simple cloud function taking user address as a param. but its returning the following error.
Uncaught (in promise) Error: Invalid function
Code below
Moralis.Cloud.define(“cloudfn”, async (request) => {
const userAddress = request.params.userAddress;
const logger = Moralis.Cloud.getLogger();
const data = Moralis.Object.extend(“Testdata”);
const fromQuery = new Moralis.Query(data);
fromQuery.equalTo(“from”, userAddress);
logger.info(“working”);
const Results = await fromQuery.find();
logger.info(Results);
return Results;
});
I tried the following to resolve it didn’t work.
- No syntax error/warning with cloud function.
- The following is the way I am calling cloud function
async function cloudFunction() {
console.log(userAddress, “This is UserAddress”);
const getData = await Moralis.Cloud.run(“cloudfn”, { userAddress });
}