Skip to content

ApolloError: Cannot read property 'type' of undefined #67

@Freire71

Description

@Freire71

Hi @jneurock, I'm getting this error while trying to execute a query that does not include any "type" property. When I inspect the ApolloError object does not give any valuable information about the error location. I've got no errors while trying to seed this "Contacts" Entity, however, the MirageJS query does not work properly. Could it be some conflict of dependencies? I'm using:

"@miragejs/graphql": "^0.1.13",
"graphql": "^16.6.0",
"@apollo/client": "^3.7.4",

Apollo Client Error object

image

Query that throws this error

query clients($take: Int) {
    contacts(take: $take) {
        edges {
            id
            firstName
            lastName
            location
            photoUrl
        }
        pageInfo {
            totalCount
        }
    }
}

Server.ts queries - I'm not using automatic query handling, because of intermediary pagination types involved (edges and pageInfo). The console.log call inside the contacts query does not get triggered, I've only gotten the error. I'm assuming that this custom resolver is not working, however, the listings query works fine

        Query: {
          listings: () => ({
            edges: this.schema.all('Listing'),
            pageInfo: {
              currentPage: 0,
              itemCount: 200,
              hasNextPage: false,
              hasPreviousPage: false,
              perPage: 200,
              pageCount: 1,
            },
            contacts: () => {
              console.log('>>>>> Contact query');
              return {
                edges: this.schema.all('Contact'),
                pageInfo: {
                  totalCount: 100,
                },
              };
            },
          }),
        },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions