Reputation: 5
I'm trying to run some very basic cloud code function on my parse-server and I get the same error every time: 141 Invalid function. I'm just adding a main.js file with my function in the cloud directory and trying to call it using Postman, but it looks like the file is not even called.
I've tried locally and on a docker, if the function exist or not I get the same result, and tried restarting the docker container after adding the code. I also tried adding a body to the request with parameters like master and functionName.
Here's my cloud code function (cloud/main.js):
Parse.Cloud.define('hello', function(req, res) {
return "function called";
});
Calling the function with a POST request on https://myurl/parse/functions/hello and getting:
{
"code": 141,
"error": "Invalid function: \"hello\""
}
Upvotes: 0
Views: 1988
Reputation: 905
The response
object has been removed from Parse Server Cloud Code post v3.0.0
.
Your Cloud Code function should look like this...
Parse.Cloud.define("hello", async (request) => {
return "function called";
});
Please read the migration guide for more details on updating your cloud code to v3.0.0
or above.
Upvotes: 1