title: AWS Appsync Graphql query to get list of items returns empty array even though the dynamodb table has items in it
body: <p>I'm running an Angular 11 application that is integrated with AWS Amplify and Appsync using GraphQL and dynamoDB for the backend.</p>
  <p>This is my Graphql schema:-</p>
  <pre><code>type School
    @model
    @auth(
      rules: [{ allow: owner, ownerField: &quot;admins&quot;, operations: [update, read] }]
    ) {
    id: ID!
    name: String!
    admins: [Member]
    classes: [Class] @connection(name: &quot;SchoolClasses&quot;)
    members: [Member] @connection(name: &quot;SchoolMembers&quot;)
  }
  
  type Class
    @model
    @auth(
      rules: [{ allow: owner, ownerField: &quot;admins&quot;, operations: [update, read] }]
    ) {
    id: ID!
    name: String!
    school: School @connection(name: &quot;SchoolClasses&quot;)
    admins: [Member]
    members: [Member] @connection(name: &quot;ClassMembers&quot;)
  }
  
  type Member @model @auth(rules: [{ allow: owner }]) {
    id: ID!
    name: String!
    school: School @connection(name: &quot;SchoolMembers&quot;)
    class: Class @connection(name: &quot;ClassMembers&quot;)
  }
  </code></pre>
  <p>This is my client definition:-</p>
  <pre><code>const client = new AWSAppSyncClient({
    url: awsconfig.aws_appsync_graphqlEndpoint,
    region: awsconfig.aws_appsync_region,
    auth: {
      type: awsconfig.aws_appsync_authenticationType,
      jwtToken: async () =&gt;
        (await Auth.currentSession()).getAccessToken().getJwtToken(),
    },
    complexObjectsCredentials: () =&gt; Auth.currentCredentials(),
    cacheOptions: {
      dataIdFromObject: (obj: any) =&gt; `${obj.__typename}:${obj.myKey}`,
    },
  });
  </code></pre>
  <p>This is my query method:-</p>
  <pre><code>    client
        .query({
          query: ListSchools,
        })
        .then((data: any) =&gt; {
          console.log('data from listSchools ', data);
          console.log(data.data.listSchools.items);
        });
    };
  </code></pre>
  <p>This is my query definition:-</p>
  <pre><code>import gql from 'graphql-tag';
  
  export default gql`
    query ListSchools(
      $filter: ModelSchoolFilterInput
      $limit: Int
      $nextToken: String
    ) {
      listSchools(filter: $filter, limit: $limit, nextToken: $nextToken) {
        items {
          id
          name
          admins {
            id
            name
            createdAt
            updatedAt
            owner
          }
          classes {
            nextToken
          }
          members {
            nextToken
          }
          createdAt
          updatedAt
        }
        nextToken
      }
    }
  `;
  </code></pre>
  <p>The output for data in the console looks like this:-</p>
  <pre><code>{
     &quot;data&quot;:{
        &quot;listSchools&quot;:{
           &quot;items&quot;:[],
           &quot;nextToken&quot;:null,
           &quot;__typename&quot;:&quot;ModelSchoolConnection&quot;
        }
     },
     &quot;loading&quot;:false,
     &quot;networkStatus&quot;:7,
     &quot;stale&quot;:false
  }
  </code></pre>
  <p>As you can see, the items is an empty array. But currently I have 3 items in my dynamoDB table:-</p>
  <p><a href="https://i.stack.imgur.com/EwMIp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EwMIp.png" alt="enter image description here" /></a></p>
  <p>What am I doing wrong?</p>
  <p>I have checked the regions to see if it is querying a different region, but it is checking the correct region, so I should be seeing the results. Also, wouldn't it throw an error if we're querying the wrong table?</p>