apollographql / apollographql/federation

TypeError: Cannot read property 'kind' of undefined

Open
#412 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
725
Forks
276
Avg merge
1h 47m
Merged PRs (30d)
1

Description

When I try to setup federation on my graphql server, I get this error:

```javascript
node_modules/graphql/validation/rules/KnownDirectives.js:48
if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) {
^

TypeError: Cannot read property 'kind' of undefined
```

My schema doesn't use any `@` annotations but it does have `Subscription`.

```javascript
const server = new ApolloServer({
schema: buildFederatedSchema([{ typeDefs, resolvers }]),
// ....
});
```

```javascript
"apollo-server-express": "^2.12.0",
```

Everything was working fine (in non federated mode) before I added the `schema:` configuration.

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with the shown ApolloServer schema configuration, a federated schema containing Subscription, and the reported apollo-server-express version. Start at node_modules/graphql/validation/rules/KnownDirectives.js:48 and compare federated versus non-federated setup; done means federation no longer raises the undefined-kind TypeError for this schema.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, javascript
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.