2

I'm running parse-server and trying to create a parse cloud code function. I started with this oversimplified example:

Parse.Cloud.define("createContent", function(request, response) {
  response.error("not implemented");
});

I can call my function using the REST API with curl and get a JSON with an error message: {"code":141,"error":"response.error is not a function"} (this is not the error message I expected). Upon further examination response object turned out to be null.

This is the respective section of the log:

error: Failed running cloud function createContent for user undefined with:
Input: {}
Error: {"code":141,"message":"response.error is not a function"} functionName=createContent, code=141, message=response.error is not a function, , user=undefined
error: response.error is not a function code=141, message=response.error is not a function

1 Answer 1

10

It looks like you're running the latest version of the server. Please follow the migration guides:

https://github.com/parse-community/parse-server/blob/master/3.0.0.md

For example, now you'll need to write:

Parse.Cloud.define("createContent", function(request, response) {
  throw "not implemented";
});

// also valid
Parse.Cloud.define("createContent", function(request, response) {
  throw new Error("not implemented");
});

// returning a rejected promise
Parse.Cloud.define("createContent", function(request, response) {
  return Promise.reject("not implemented");
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.