[SOLVED] I don't get the response from my cloudfunction

Hi guys, I am creating some cloud functions using moralis-admin-cli, possibly I am not calling them in the proper way, because I am getting the following error:

  Moralis.Cloud.define("Hello", async (request) => {
    return "Hello Cloud functions are cool !";

  loadCloud = async () => {
   const item = await Moralis.Cloud.run("Hello");

“message”: “Invalid function: “Hello””

Uncaught (in promise) Error: Invalid function: “Hello”
_construct https://unpkg.com/[email protected]/dist/moralis.js:31205
Wrapper https://unpkg.com/[email protected]/dist/moralis.js:31555
_createSuper https://unpkg.com/[email protected]/dist/moralis.js:12820
ParseError https://unpkg.com/[email protected]/dist/moralis.js:12871
handleError https://unpkg.com/[email protected]/dist/moralis.js:26465
promise callback*request https://unpkg.com/[email protected]/dist/moralis.js:26455
run https://unpkg.com/[email protected]/dist/moralis.js:459
run https://unpkg.com/[email protected]/dist/moralis.js:385

am I missing something? thanks.

Do you have this Hello cloud function saved in your server? The invalid function error typically happens when the cloud function you’re calling doesn’t exist.

You can check easily from the legacy UI.

In my cli it seems to indicate that it is loading the changes correctly, but following your recommendation when checking from legacy UI. i get nothing

watch-cloud-folder --something code here example --moralisCloudfolder "\cloud.js"
ncc: Version 0.29.2
ncc: Compiling file index.js into CJS
Changes Uploaded Correctly

this is my legacy UI.

/******/ (() => { // webpackBootstrap
/******/ 	/* webpack/runtime/compat */
/******/ 	if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
var __webpack_exports__ = {};

module.exports = __webpack_exports__;
/******/ })()

It looks like it hasn’t saved. The path in your command needs to be a directory/folder, not a file in your case (\cloud.js).

@alex I set up my cloud function with my full path C:\Users\Oliver\Documents\Vsc\moralis\cloud\cloud.js but it doesn’t seem to get saved yet :pensive:

oh man sorry that’s right thank you it works great @alex :ok_hand: :100: :clap:

1 Like