Can't fetch schema in packaged app, works in dev mode
See original GitHub issueDescribe the bug Sometime last year prior to October, Insomnia (binary) was no longer able to fetch the schema from a graphql server that it previously worked fine with.
The GraphQLEditor
component shows a small modal saying Failed to fetch schema: list.reduce is not a function
At the same time though, the schema is resolved without issue in the GraphQL playground provided by the server, the Altair GraphQL app (though they’re using a “GraphQL Event Stream protocol” for schema fetching, I thought it worth mentioning), and I can run the introspection query manually in Insomnia and get a valid response:
Introspection Query
query schema {
__schema {
types {
name
}
}
}
query type {
__type(name: "List") {
name
kind
fields {
name
type {
name
kind
ofType {
name
kind
}
}
}
}
}
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
subscriptionType { name }
types {
...FullType
}
directives {
name
description
locations
args {
...InputValue
}
}
}
}
fragment FullType on __Type {
kind
name
description
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
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
}
}
}
}
}
}
}
}
Response
{
"data": {
"__type": {
"name": "List",
"kind": "OBJECT",
"fields": {
"0": {
"name": "id",
"type": {
"name": {},
"kind": "NON_NULL",
"ofType": {
"name": "Int",
"kind": "SCALAR"
}
}
},
"1": {
"name": "datePublished",
"type": {
"name": {},
"kind": "NON_NULL",
"ofType": {
"name": "String",
"kind": "SCALAR"
}
}
},
"2": {
"name": "dateUpdated",
"type": {
"name": {},
"kind": "NON_NULL",
"ofType": {
"name": "String",
"kind": "SCALAR"
}
}
},
"3": {
"name": "modified",
"type": {
"name": {},
"kind": "NON_NULL",
"ofType": {
"name": "String",
"kind": "SCALAR"
}
}
},
"4": {
"name": "content",
"type": {
"name": {},
"kind": "NON_NULL",
"ofType": {
"name": "String",
"kind": "SCALAR"
}
}
},
"5": {
"name": "excerpt",
"type": {
"name": {},
"kind": "NON_NULL",
"ofType": {
"name": "String",
"kind": "SCALAR"
}
}
},
"6": {
"name": "title",
"type": {
"name": {},
"kind": "NON_NULL",
"ofType": {
"name": "String",
"kind": "SCALAR"
}
}
},
"7": {
"name": "status",
"type": {
"name": {},
"kind": "NON_NULL",
"ofType": {
"name": "String",
"kind": "SCALAR"
}
}
},
"8": {
"name": "commentStatus",
"type": {
"name": {},
"kind": "NON_NULL",
"ofType": {
"name": "String",
"kind": "SCALAR"
}
}
},
"9": {
"name": "name",
"type": {
"name": {},
"kind": "NON_NULL",
"ofType": {
"name": "String",
"kind": "SCALAR"
}
}
},
"10": {
"name": "link",
"type": {
"name": {},
"kind": "NON_NULL",
"ofType": {
"name": "String",
"kind": "SCALAR"
}
}
},
"11": {
"name": "guid",
"type": {
"name": {},
"kind": "NON_NULL",
"ofType": {
"name": "String",
"kind": "SCALAR"
}
}
},
"12": {
"name": "type",
"type": {
"name": {},
"kind": "NON_NULL",
"ofType": {
"name": "String",
"kind": "SCALAR"
}
}
},
"13": {
"name": "commentCount",
"type": {
"name": {},
"kind": "NON_NULL",
"ofType": {
"name": "Int",
"kind": "SCALAR"
}
}
},
"14": {
"name": "metaTitle",
"type": {
"name": "String",
"kind": "SCALAR",
"ofType": {}
}
},
"15": {
"name": "metaDescription",
"type": {
"name": "String",
"kind": "SCALAR",
"ofType": {}
}
},
"16": {
"name": "rssStructuredContent",
"type": {
"name": "String",
"kind": "SCALAR",
"ofType": {}
}
},
"17": {
"name": "structuredSummary",
"type": {
"name": "String",
"kind": "SCALAR",
"ofType": {}
}
},
"18": {
"name": "listType",
"type": {
"name": "String",
"kind": "SCALAR",
"ofType": {}
}
},
"19": {
"name": "listSections",
"type": {
"name": {},
"kind": "LIST",
"ofType": {
"name": "ListSection",
"kind": "OBJECT"
}
}
},
"20": {
"name": "authors",
"type": {
"name": {},
"kind": "LIST",
"ofType": {
"name": "Author",
"kind": "OBJECT"
}
}
},
"21": {
"name": "heroImage",
"type": {
"name": "HeroImage",
"kind": "OBJECT",
"ofType": {}
}
},
"22": {
"name": "featuredImage",
"type": {
"name": "FeaturedImage",
"kind": "OBJECT",
"ofType": {}
}
},
"23": {
"name": "update",
"type": {
"name": "Update",
"kind": "OBJECT",
"ofType": {}
}
},
"24": {
"name": "images",
"type": {
"name": {},
"kind": "LIST",
"ofType": {
"name": "String",
"kind": "SCALAR"
}
}
},
"25": {
"name": "previewImages",
"type": {
"name": {},
"kind": "LIST",
"ofType": {
"name": "PreviewImage",
"kind": "OBJECT"
}
}
},
"26": {
"name": "structuredContent",
"type": {
"name": {},
"kind": "NON_NULL",
"ofType": {
"name": "String",
"kind": "SCALAR"
}
}
},
"27": {
"name": "relatedTermSlugs",
"type": {
"name": {},
"kind": "NON_NULL",
"ofType": {
"name": {},
"kind": "LIST"
}
}
},
"28": {
"name": "fromSweethome",
"type": {
"name": {},
"kind": "NON_NULL",
"ofType": {
"name": "Boolean",
"kind": "SCALAR"
}
}
},
"29": {
"name": "relatedContent",
"type": {
"name": {},
"kind": "NON_NULL",
"ofType": {
"name": {},
"kind": "LIST"
}
}
}
}
}
}
}
The real notable thing is that this issue is not present when running the app in dev mode.
While running npm run app-start
:
To Reproduce Steps to reproduce the behavior:
- ¯\(ツ)/¯
Expected behavior Schema should be fetched
Screenshots From Oct 1, in a post in Slack:
Desktop (please complete the following information):
- OS: macOS 10.15.7
- Installation Method: binary tested both via
homebrew
andnpm run app-build:smoke
(same behavior), dev mode run vianpm run app-start
- App version:
- via
homebrew
: 7.1.1 - via
npm
scripts, pulleddevelop
today (eb4ae99)
- via
Additional context Relevant GraphQL server dependencies:
"apollo-server-express": "^2.1.0",
"express": "^4.16.3",
"graphql": "^0.13.2",
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (2 by maintainers)
Top GitHub Comments
The issue was with my plugin, and the plugin has been patched. Thanks for @develohpanda’s help in Slack (thread)
my colleague stumbled upon this bug and realized it doesn’t happen when the plugin I created is disabled!
I think I just need to not have the plugin do anything on introspection requests, but I’m not sure how to check for that in the response context 🤔