0

I am new to js. I have a cloud code function to signup a user which works fine except that I could not retrieve the original error message. For example, when I use an existing user name to signUp, I expect {"code":202,"error":"username cooldude6 already taken"} but get {"code":141,"error":"An error has occurred"} which is the error code for issues with cloud code. Any help would be appreciated.

Parse.Cloud.define("signupUserTest", function(request, response) {

Parse.Cloud.useMasterKey(); //to bypass ACLs

var user = new Parse.User();
user.set("email", request.params.email); //optional
user.set("username", request.params.username); //required
user.set("password", request.params.password); //required

user.signUp(null, {
    success: function(user) {    
        response.success("success!");
    },
    error: function(error) {
        console.log(error);
        console.error(error);
        response.error(error.message);
    }
});     
});

And the log/error shows

E2014-11-03T22:39:05.098Z] v593: Ran cloud function signupUser with:
  Input: {"email":"a123@gmail.com","password":"p_n7!-e8","username":"cooldude6"}
  Failed with: An error has occurred
4

1 に答える 1

0

Hector がここで指摘しているように、 https://groups.google.com/forum/# !topic/parse-developers/cydcz_p9rvU

signUpのエラー コールバック署名にユーザーパラメータがありませんでした

    error: function(user, error) {
        console.log(error);
        console.error(error);
        response.error(error.message);
    }
于 2014-11-03T23:37:12.750 に答える