title: Error: GraphQL error: Query condition missed key schema element
body: <p>I am using Amplify and therefore DynamoDB. I believe I have a fairly simple schema setup, but coming from MySQL my brain is going a little screw!!</p>
  <p>The basic setup (a football league) is,</p>
  <pre><code>[League]
     [Season]
       [Divisions]
          [Teams]
             [Club]
                [Ground]
  [Club]
    [Teams]
       [TeamConnection] (I needed a connection schema as a team can belong to multiple divisions/seasons/leagues. I could not think of another way to connect this on the `Team` model)
          [League]
          [Season]
          [Division]
  </code></pre>
  <p>Schemas</p>
  <pre><code>    ....
      Other Schemas
      ...
  type Club @model @key(name: &quot;byClub&quot;, fields: [&quot;leagueID&quot;, &quot;name&quot;])
      {
        id: ID!
        name: String!
        leagueID: ID!
        leagues: [League] @connection(fields: [&quot;leagueID&quot;])
        teams: [Team] @connection(keyName: &quot;byTeams&quot;, fields: [&quot;id&quot;])
        grounds: [Ground] @connection(keyName: &quot;byGround&quot;, fields: [&quot;id&quot;])
      }
  
  enum TeamGender {
        Male
        Female
      }
      
  type Team @model
        @key(name: &quot;byTeamsClubId&quot;, fields: [&quot;clubID&quot;])
        @key(name: &quot;byTeams&quot;, fields: [&quot;clubID&quot;, &quot;name&quot;])
        {
          id: ID!
          name: String!
          faId: ID!
          clubID: ID!
          club: Club @connection(fields: [&quot;clubID&quot;])
          teamDetails: [TeamConnection] @connection(keyName: &quot;byTeamsConnection&quot;, fields: [&quot;id&quot;])
          gender: TeamGender!
        }
  
  type TeamConnection @model @key(name: &quot;byTeamsConnection&quot;, fields: [&quot;teamID&quot;,&quot;seasonID&quot;, &quot;leagueID&quot;, &quot;divisionID&quot;])
      
      {
        id: ID!
        teamID: ID!
        leagueID: ID!
        seasonID: ID!
        divisionID: ID!
        leagues: [League] @connection(fields: [&quot;leagueID&quot;])
        teams: [Team] @connection(fields: [&quot;teamID&quot;])
        seasons: [Season] @connection(fields: [&quot;seasonID&quot;])
        divisions: [Division] @connection(fields: [&quot;divisionID&quot;])
      }
  
  type Ground @model @key(name: &quot;byGround&quot;, fields: [&quot;clubID&quot;, &quot;name&quot;])
  
      {
        id: ID!
        name: String!
        address1: String
        address2: String
        town: String
        postcode: String
        rating: Int
        type: String
        link: String
        clubID: ID!
        clubs: [Club] @connection(fields: [&quot;clubID&quot;])
      }
  
  </code></pre>
  <h2>Error</h2>
  <p>This query works with no error</p>
  <pre><code>//$leagueID: ''
  export const LIST_CLUBS = /* GraphQL */ `
    query ListClubs($leagueID: ID) {
      listClubs(filter: { leagueID: { eq: $leagueID } }) {
        items {
          name
          leagueID
        }
      }
    }
  `
  </code></pre>
  <p>This is the auto generated query used. If I used the <strong>below query</strong>, then the error seen below will kick in. This does confuse me.</p>
  <pre><code>
  //filter: { leagueID: { eq: leagueID } },
  
      export const listClubs = /* GraphQL */ `
        query ListClubs(
          $filter: ModelClubFilterInput
          $limit: Int
          $nextToken: String
        ) {
          listClubs(filter: $filter, limit: $limit, nextToken: $nextToken) {
            items {
              id
              name
              leagueID
              leagues {
                items {
                  id
                  name
                  faId
                  logo
                  seasons {
                    items {
                      id
                      name
                      faId
                      yearStart
                      yearEnd
                      leagueID
                      createdAt
                      updatedAt
                    }
                    nextToken
                  }
                  division {
                    items {
                      id
                      name
                      faId
                      divisionSeasonFaId
                      leagueID
                      seasonID
                      ageInput
                      level
                      createdAt
                      updatedAt
                    }
                    nextToken
                  }
                  createdAt
                  updatedAt
                }
                nextToken
              }
              teams {
                items {
                  id
                  name
                  faId
                  clubID
                  club {
                    id
                    name
                    leagueID
                    leagues {
                      nextToken
                    }
                    teams {
                      nextToken
                    }
                    grounds {
                      nextToken
                    }
                    createdAt
                    updatedAt
                  }
                  teamDetails {
                    items {
                      id
                      teamID
                      leagueID
                      seasonID
                      divisionID
                      createdAt
                      updatedAt
                    }
                    nextToken
                  }
                  gender
                  createdAt
                  updatedAt
                }
                nextToken
              }
              grounds {
                items {
                  id
                  name
                  address1
                  address2
                  town
                  postcode
                  rating
                  type
                  link
                  clubID
                  clubs {
                    items {
                      id
                      name
                      leagueID
                      createdAt
                      updatedAt
                    }
                    nextToken
                  }
                  createdAt
                  updatedAt
                }
                nextToken
              }
              createdAt
              updatedAt
            }
            nextToken
          }
        }
      `;
  
  </code></pre>
  <p>//Console</p>
  <pre><code>Error: GraphQL error: Query condition missed key schema element
  GraphQL error: Query condition missed key schema element
  GraphQL error: Query condition missed key schema element
  GraphQL error: Query condition missed key schema element
  GraphQL error: Query condition missed key schema element
  GraphQL error: Query condition missed key schema element
  GraphQL error: Query condition missed key schema element
  GraphQL error: Query condition missed key schema element
  GraphQL error: Query condition missed key schema element
  GraphQL error: Query condition missed key schema element
  GraphQL error: Query condition missed key schema element
      at new ApolloError (/var/www/co.uk/node_modules/apollo-client/bundle.umd.js:92:26)
  </code></pre>
  <p>Query working as mentioned above.
  <a href="https://i.stack.imgur.com/3iWlx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3iWlx.png" alt="enter image description here" /></a></p>
  <p>Errors returned from GraphIQL</p>
  <p><a href="https://i.stack.imgur.com/jHnRH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jHnRH.png" alt="enter image description here" /></a>
  However frustratingly, which I did not know. The data is actually returned, plus the errors at the end.</p>
  <p><a href="https://i.stack.imgur.com/HKe5C.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HKe5C.png" alt="enter image description here" /></a></p>