title: Cannot read property 'id' of undefined. Variable 'id' has coerced Null value for NonNull type 'ID!'
body: <p>I am using react native gifted chat and I am trying to figure out how to set _id, text, createdAt, userid, and name to the parameters of my mutation. I have been getting the following errors <code>variable id has coerced null value</code> or <code>cannot read property 'id' is undefined</code>. The main question I have is what to set messageid and messagetext to. I am using react native gifted chat with AWS.</p>
  
  <pre class="lang-js prettyprint-override"><code>export const createMessage = `mutation createMessage($id: ID! $groupchatid: ID! $message: String! $createdUser: String! $createdTime: String!) {
      createMessage(input:{ id:$id groupchatid:$groupchatid, message:$message, createdUser: $createdUser createdTime: $createdTime}) {
        id
        groupchatid
        message
        createdUser
        createdTime
      }
  }`;
  </code></pre>
  
  <pre><code>    const user = Auth.currentAuthenticatedUser();
      this.setState({ username: user.username});
    }
  
    MessagesMutation = async () =&gt; {
      const AddMessage = { message: this.state.messages, createdUser: this.state.username, groupchatid: this.state.groupchatname };
      const newGroupChatMessage = await API.graphql(graphqlOperation(createMessage, AddMessage));
      console.log(JSON.stringify(newGroupChatMessage));
    };
  
  
    componentWillMount() {
      this.setState({
        messages: [
          {
            _id: id,
            text: message,
            createdAt: new Date(),
            user: {
              _id: createdUser,
              name: createdUser,
              avatar: 'https://placeimg.com/140/140/any',
  
            },
  
  
          },
        ],
      })
    }
  
  
    componentDidMount() {
      const { navigation } = this.props;
      const value = navigation.getParam('value')
      this.setState({groupchatname: value})
    }
  
  
  
    onSend(messages = []) {
      this.setState(previousState =&gt; ({
        messages: GiftedChat.append(previousState.messages, messages),
      }))
    }
    render(){
      const { groupchatname} = this.state;
    return (
        &lt;SafeAreaView style={{ flex: 1 }}&gt;
          &lt;Header style={styles.headerColor}&gt;
              &lt;Text style={styles.text}&gt;{groupchatname}&lt;/Text&gt; 
          &lt;/Header&gt;
          &lt;GiftedChat
              messages={this.state.messages}
              renderUsernameOnMessage={true}
              onSend={messages =&gt; this.onSend(messages), this.MessagesMutation}
              user={{
              _id: this.user,
              name: this.user,
              avatar: 'https://placeimg.com/140/140/any'
              }}```
  </code></pre>