graphdoc
graphdoc copied to clipboard
I got an error when generate graphdoc
Hi. I got an error when generating from graphql endpoint. Does anyone help me?
$(npm bin)/graphdoc -e http://localhost:62222/graphql -o output
/Users/yousan/.ghq/github.com/yousan/graphql/graphql/node_modules/@2fd/graphdoc/lib/schema-loader/http.js:53
return resolve(body.data.__schema);
^
TypeError: Cannot read property '__schema' of undefined
at Request._callback (/Users/yousan/.ghq/github.com/yousan/graphql/graphql/node_modules/@2fd/graphdoc/lib/schema-loader/http.js:53:50)
at Request.self.callback (/Users/yousan/.ghq/github.com/yousan/graphql/graphql/node_modules/request/request.js:185:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request.<anonymous> (/Users/yousan/.ghq/github.com/yousan/graphql/graphql/node_modules/request/request.js:1161:10)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at IncomingMessage.<anonymous> (/Users/yousan/.ghq/github.com/yousan/graphql/graphql/node_modules/request/request.js:1083:12)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickCallback (internal/process/next_tick.js:181:9)
Are your using Apollo as graphql server?
@2fd Thank you for your reply. No, I am using serverless-offiline and serverless-appsync as a GraphQL server.
Can you execute this query and post the result?
query IntrospectionQuery {
__schema {
queryType { name description kind}
mutationType { name description kind }
subscriptionType { name description kind }
}
}
I get the same error. The output of the query mentioned by @2fd here is this:
{
"data": {
"__schema": {
"queryType": {
"name": "Query",
"description": null,
"kind": "OBJECT"
},
"mutationType": {
"name": "Mutation",
"description": null,
"kind": "OBJECT"
},
"subscriptionType": null
}
}
}
EDIT:
I've checked the complete introspection query that is as follows:
query IntrospectionQuery {
__schema {
queryType { name description kind}
mutationType { name description kind }
subscriptionType { name description kind }
types {
name
kind
description
...FullType
}
directives {
name
description
locations
args {
...InputValue
}
}
}
}
fragment FullType on __Type {
fields(includeDeprecated: true) {
name
description
args {
...InputValue
}
type {
...TypeRef
}
isDeprecated
deprecationReason
}
inputFields {
...InputValue
}
interfaces {
...TypeRef
}
enumValues(includeDeprecated: true) {
name
description
isDeprecated
deprecationReason
}
possibleTypes {
...TypeRef
}
}
fragment InputValue on __InputValue {
name
description
type { ...TypeRef }
defaultValue
}
fragment TypeRef on __Type {
kind
name
description
ofType {
kind
name
description
ofType {
kind
name
description
ofType {
kind
name
description
ofType {
kind
name
description
ofType {
kind
name
description
ofType {
kind
name
description
ofType {
kind
name
description
}
}
}
}
}
}
}
}
Our GraphQL has a validator allowing a maximum query depth of 10 while a depth of 11 is provided in the query I just mentioned. After changing the maximum allowed depth to 11 the tool worked perfectly fine.