I've been trying to setup Federation but extend doesn't seem to be parsed by the GraphQL parser.
This is the definition that's throwing the error:
extend type CurrentIdentity @key(fields: "id") {
id: ID! @external
profile: Person
}
For the full definition check here.
This is the exact error I'm getting:
GraphQLError: Syntax Error: Unexpected Name "extend"
at syntaxError (/ahau/@ssb-graphql/profile/node_modules/graphql/error/syntaxError.js:15:10)
at Parser.unexpected (/ahau/@ssb-graphql/profile/node_modules/graphql/language/parser.js:1463:41)
at Parser.parseTypeSystemDefinition (/ahau/@ssb-graphql/profile/node_modules/graphql/language/parser.js:715:16)
at Parser.parseDefinition (/ahau/@ssb-graphql/profile/node_modules/graphql/language/parser.js:154:19)
at Parser.many (/ahau/@ssb-graphql/profile/node_modules/graphql/language/parser.js:1518:26)
at Parser.parseDocument (/ahau/@ssb-graphql/profile/node_modules/graphql/language/parser.js:111:25)
at parse (/ahau/@ssb-graphql/profile/node_modules/graphql/language/parser.js:36:17)
at parseDocument (/ahau/@ssb-graphql/profile/node_modules/graphql-tag/lib/graphql-tag.umd.js:135:16)
at gql (/ahau/@ssb-graphql/profile/node_modules/graphql-tag/lib/graphql-tag.umd.js:176:10)
at Object.<anonymous> (/ahau/@ssb-graphql/profile/src/typeDefs.js:3:21)
And these are the package versions I'm using:
"@apollo/federation": "^0.11.3",
"apollo-server": "^2.9.3",
"apollo-server-express": "^2.9.6",
"graphql": "^14.5.8",
@IvanGoncharov you might hold the answer.
@luandro It looks like you have either docstring or comment before extend, right?
It's not allowed to add descriptions to extend definitions but I totally agree that we need to improve error message.
OH! Can't believe it was that simple. Been blocker for the whole week :cry:
Thanks @IvanGoncharov!
@luandro Great to hear 馃憤
BTW. If you ever experience a similar issue you can try to catch the error and call console.log(error.toString()) see here for more details: https://github.com/graphql/graphql-js/issues/2215#issuecomment-540054812
@IvanGoncharov I want to work on this. Please assign it to me :)
Most helpful comment
@luandro It looks like you have either docstring or comment before
extend, right?It's not allowed to add descriptions to extend definitions but I totally agree that we need to improve error message.