1

I'm getting started with Relay and GraphCool and have trouble creating the createUser Mutation with Relay.

This is my current code:

import Relay from 'react-relay';

class SignupUserMutation extends Relay.Mutation {

getMutation() {
    return Relay.QL`
        mutation {
            createUser(input: {
                authProvider: {email: { email: $email, password: $password }},
                clientMutationId: "createuser1"
            }) {
                clientMutationId
            }
        }
    `;
}

getVariables() {
    return {
        email:    this.props.email,
        password: this.props.password
    };
}

getFatQuery() {
    return Relay.QL`
        fragment on CreateUserPayload {
            viewer { id }
        }
    `;
}

getConfigs() {
    return [{
        type:           'RANGE_ADD',
        parentName:     'viewer',
        parentID:       this.props.viewerId,
        connectionName: 'users',
        edgeName:       'usereEdge',
        rangeBehaviors: {
            '': 'append',
        },
    }];
}

}

export default SignupUserMutation;

I keep getting the error:

Variable '$input_0' expected value of type 'SignupUserInput!' but got: {"email":"fdadsffd@fasdf.at","password":"@fdsad","clientMutationId":"1"}. Reason: Unknown field 'email' is not defined in the input type 'SignupUserInput'. (line 1, column 29):↵mutation SignupUserMutation($input_0:SignupUserInput!) {

What am I doing wrong here?

SimonEritsch
  • 1,047
  • 1
  • 8
  • 22
  • Have you tried copying from [this example](https://www.graph.cool/docs/reference/simple-api/user-authentication-eixu9osueb/#email-and-password)? It looks like you should drop the `input` object and just pass the `authProvider` to `createUser`. – ArneHugo May 08 '17 at 11:08
  • did you enable the authentication provider for email & password in the **Integrations** menu? – nburk May 22 '17 at 16:40
  • @ArneHugo your link is broken, could you fix? Thanks – Lane Rettig Sep 30 '17 at 17:35
  • I'm sorry @LaneRettig, I don't know where that article was moved to. I can't edit my comment, but perhaps I should just delete it? – ArneHugo Oct 02 '17 at 14:57

0 Answers0