Skip to content
This repository was archived by the owner on Sep 3, 2021. It is now read-only.
This repository was archived by the owner on Sep 3, 2021. It is now read-only.

Can't query interface types #414

Closed
@gilesdring

Description

@gilesdring

I have the following schema

interface Person {
  id: ID!
  name: String
}

type A implements Person {
  id: ID!
  name: String
}

type B implements Person {
  id: ID!
  name: String
}

When I run a query of the type:

query {
  Person {
    name
  }
}

I get the following error from the server.

Abstract type \"Person\" must resolve to an Object type at runtime for field \"Query.Person\" with value { name: \"A Person\", FRAGMENT_TYPE: null }, received \"null\". Either the \"Person\" type should provide a \"resolveType\" function or each possible type should provide an \"isTypeOf\" function.

The full stacktrace is:

GraphQLError: Abstract type "Person" must resolve to an Object type at runtime for field "Query.Person" with value { name: "Giles Dring", FRAGMENT_TYPE: null }, received "null". Either the "Person" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.
    at ensureValidRuntimeType (/Users/gilesdring/src/dringtech/eccoo/graph/api/node_modules/graphql/execution/execute.js:687:11)
    at completeAbstractValue (/Users/gilesdring/src/dringtech/eccoo/graph/api/node_modules/graphql/execution/execute.js:680:42)
    at completeValue (/Users/gilesdring/src/dringtech/eccoo/graph/api/node_modules/graphql/execution/execute.js:604:12)
    at completeValueCatchingError (/Users/gilesdring/src/dringtech/eccoo/graph/api/node_modules/graphql/execution/execute.js:514:19)
    at /Users/gilesdring/src/dringtech/eccoo/graph/api/node_modules/graphql/execution/execute.js:636:25
    at from (<anonymous>)
    at completeListValue (/Users/gilesdring/src/dringtech/eccoo/graph/api/node_modules/graphql/execution/execute.js:632:49)
    at completeValue (/Users/gilesdring/src/dringtech/eccoo/graph/api/node_modules/graphql/execution/execute.js:592:12)
    at /Users/gilesdring/src/dringtech/eccoo/graph/api/node_modules/graphql/execution/execute.js:511:16
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

This seems similar to a few other issues, but not exactly. I'm using v2.13.0. The way I'm reading the documentation, it should work.

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