title: AppSync/Amplify Query using a Parameter Error ""Validation error of type FieldUndefined:"
body: <p>I currently have a AppSync schema where I created a separate query within the AppSync console in order retain certain parameter (assetId) and get a list of the results in my DynamoDB table. I have tested the query already within the AppSync console and it works fine, I am now just having troubles using Amplify in my React App in order to call the query. I get the following error when running my App:</p>
  
  <pre><code>DisplayCard.js:34 Uncaught (in promise) {data: null, errors: Array(1)}
  "Validation error of type FieldUndefined: Field 'getAssetIdRating' in type 'Query' is undefined @ 'getAssetIdRating'"
  </code></pre>
  
  <p>I have tried following the documentation as per the Amplify site (<a href="https://aws-amplify.github.io/docs/js/api" rel="nofollow noreferrer">https://aws-amplify.github.io/docs/js/api</a>) but am still receiving this error.</p>
  
  <p>For reference here is the query when I run it in the AppSync console: (returns the desired result)</p>
  
  <pre><code>    query getAssetIdRating {
        getRatingsAssetId(assetId:"949142fb-91d2-41bd-8c04-1d42ed8166c9") {
          items {
            id
            assetId
            rating
          }
        }
      }
  </code></pre>
  
  <p>The resolver that I am using for this query is the following: (I have created a separate Index)</p>
  
  <pre><code>{
      "version" : "2017-02-28",
      "operation" : "Query",
      "index": "assetId-index",
      "query" : {
          ## Provide a query expression. **
          "expression": "assetId = :assetId",
          "expressionValues" : {
              ":assetId" : $util.dynamodb.toDynamoDBJson($ctx.args.assetId)
          }
      }
  }
  </code></pre>
  
  <p>And now moving onto my React code, this is the current query that I am using within react, under src/graphql/queries.</p>
  
  <pre><code>    export const getAssetIdRating = /* GraphQL */ `
        query getRatingAssetId($assetId: ID) {
          getAssetIdRating(assetId: $assetId) {
            items {
              id
              assetId
              rating
            }
          }
        }
      `;
  </code></pre>
  
  <p>And when I call it then in my React application:</p>
  
  <pre><code>componentDidMount = async () =&gt; {
      this.getRatings();
  }
  
  getRatings = async () =&gt; {
      let { assetIdRatings } = this.state;
      const result = await API.graphql(graphqlOperation(queries.getAssetIdRating, {assetId: '949142fb-91d2-41bd-8c04-1d42ed8166c9'}));
      console.log(result);
  }
  </code></pre>
  
  <p>Note that when I call the listRatings query it works fine, just does not work with this query. And as a side note, I added this query later in manually through the AppSync console, I don't presume that should play an issue?</p>
  
  <p>Either way, any help would be greatly appreciated! And I can upload anymore necessary code if required! Thanks for the help!</p>