Hi, I don’t know why I can’t use cloud functions.
in the Cloud Functions I putted:
Moralis.Cloud.define("hello", async (request) => {
return:"HELLO WORLD"
});
then, in my web-page script i putted:
serverUrl = "my server url";
appId = "my app id";
Moralis.start({ serverUrl, appId });
let h= await Moralis.Cloud.run("hello");
console.log(h);
but in the console appear this error:
moralis.js:25981 POST https://nw1td3p9qg3y.usemoralis.com:2053/server/functions/hello 400
dispatch @ moralis.js:25981
ajax @ moralis.js:25988
(anonymous) @ moralis.js:26095
Promise.then (async)
request @ moralis.js:26089
run @ moralis.js:457
run @ moralis.js:383
(anonymous) @ VM486:1
moralis.js:30552 Uncaught Error: Invalid function: "hello"
at handleError (moralis.js:26117:17)
at async <anonymous>:1:8
and in the moralis dashboard appear this:
2022-02-19T12:48:25.940Z - Error: Invalid function: "hello"
at handleCloudFunction (/moralis-server/lib/Routers/FunctionsRouter.js:126:13)
at /moralis-server/lib/PromiseRouter.js:85:20
at processTicksAndRejections (node:internal/process/task_queues:96:5)
could someone give me an idea of what could be wrong??
thank you