2
votes

I'm using graphql apollo client for Android. I'm able to pass data using mutation for a single fields without any issue. While using input object in mutation the error cannot read property of email undefined occurred. But same graphql working while running in the browser.

Graphql mutation

mutation signup($SignupInput:SignupInput) {
    signup(data: $SignupInput) {
        result{token,firstName,lastName,profileImage}
   }
}

Input

    {"SignupInput": {"firstName": "John","lastName": "Peter","email": "[email protected]"
,"password": "123123"}}

Java Code for API call

final SignupInput signupInput=SignupInput.builder()
                .firstName(edtSignUpName.getText().toString())
                .lastName(edtSignUpLastName.getText().toString())
                .email(actvSignUpEmail.getText().toString())
                .password(edtSignUpPassword.getText().toString())
                .profileImage("dasfasdfasdf.png").build();


        final SignupMutation signupMutation = SignupMutation.builder()
                .signupInput(signupInput)
                .build();
        signupCall = appController.apolloClient()
                .mutate(signupMutation);
        signupCall.enqueue(dataCallback);
1
Is this a Java error? Can you share the complete stack trace?felipe_gdr
Did you get the answer?Mr.India
I changed the $SignupInput to $signupInput, In android or java user should use CamelCase. That is an issue in mutationSiva Sonai

1 Answers

2
votes
mutation signup($SignupInput:SignupInput)
{
    signup(data: $SignupInput) {
        result{token,firstName,lastName,profileImage}
   }
}

I changed the $SignupInput to $signupInput, In android or java user should use CamelCase. That is an issue in mutation