I am trying to use the printSchema
function from Apollo to include @directives in the GQL Schema.
However it keeps showing this error:
TypeError: Cannot read properties of undefined (reading 'kind')
at KnownDirectivesRule (node_modules\graphql\validation\rules\KnownDirectivesRule.js:43
:13)
at \node_modules\graphql\validation\validate.js:90:12
at Array.map (<anonymous>)
at validateSDL (\node_modules\graphql\validation\validate.js:89:24)
at buildSchemaFromSDL (\node_modules\@apollo\federation\node_modules\@apollo\subgraph\di
st\schema-helper\buildSchemaFromSDL.js:143:47)
at Object.buildSubgraphSchema (\node_modules\@apollo\federation\node_modules\@apollo\sub
graph\dist\buildSubgraphSchema.js:26:57)
at file:///finalizeProcessFunction.js:34:37
at SchemaBuilder.applyHooks (\node_modules\graphile-build\node8plus\SchemaBuilder.js:264
:20)
at SchemaBuilder.buildSchema (\node_modules\graphile-build\node8plus\SchemaBuilder.js:34
0:33)
at SchemaBuilder.watchSchema (\node_modules\graphile-build\node8plus\SchemaBuilder.js:40
8:34)
My schema is very long so I don't paste the whole file here, but basically it's just a normal GQL Schema that has multiple type
, then Query
, Mutation
and Subscription
.
The directives that I am adding is under Subscription
called @aws_subscribe
, it is use for AppSync subscription.
So the code that pops this error is this:
let federatedSchema = printSchema.buildSubgraphSchema(schema);
The schema type is GraphQLSchema
and it looks like this:
What am I missing here?
from GraphQL - Apollo printSchema error: TypeError: Cannot read properties of undefined (reading 'kind')
No comments:
Post a Comment