Kong / Kong/insomnia

GraphQL schema introspection failure on newer version of GraphQL server

Open
#4,739 3 comments 0 reactions 0 assignees View on GitHub
A-graphql B-bug S-unverified
Dominant language
TypeScript
Stars
40k
Forks
2.4k
Avg merge
2d 13h
Merged PRs (30d)
61

Description

### Expected Behavior

GraphQL schema introspection succeeded.

### Actual Behavior

When using the graphql server is used with ^16.4.0, the introspection response is slightly different, resulting in the automatic schema introspection failed with:
Screen Shot 2022-04-29 at 16 14 07

### Reproduction Steps

The generated schema structure seems to be changed.

The following code:
```lua
const {
buildSchema,
} = require('graphql');

var schema = buildSchema(`
type Query {
hello: String
}
`);
console.log(schema)
```

With graphql ^15.8.0 outputs:

```
GraphQLSchema {
__validationErrors: [],
description: undefined,
extensions: undefined,
astNode: undefined,
extensionASTNodes: [],
_queryType: Query,
_mutationType: undefined,
_subscriptionType: undefined,
_directives: [ @include, @skip, @deprecated, @specifiedBy ],
_typeMap: [Object: null prototype] {
Query: Query,
String: String,
Boolean: Boolean,
__Schema: __Schema,
__Type: __Type,
__TypeKind: __TypeKind,
__Field: __Field,
__InputValue: __InputValue,
__EnumValue: __EnumValue,
__Directive: __Directive,
__DirectiveLocation: __DirectiveLocation
},
_subTypeMap: [Object: null prototype] {},
_implementationsMap: [Object: null prototype] {}
}
```

On graphql ^16.4.0 outputs:
```
GraphQLSchema {
__validationErrors: undefined,
description: undefined,
extensions: [Object: null prototype] {},
astNode: undefined,
extensionASTNodes: [],
_queryType: undefined,
_mutationType: undefined,
_subscriptionType: undefined,
_directives: [
GraphQLDirective {
name: 'include',
description: 'Directs the executor to include this field or fragment only when the `if` argument is true.',
locations: [Array],
isRepeatable: false,
extensions: [Object: null prototype] {},
astNode: undefined,
args: [Array]
},
GraphQLDirective {
name: 'skip',
description: 'Directs the executor to skip this field or fragment when the `if` argument is true.',
locations: [Array],
isRepeatable: false,
extensions: [Object: null prototype] {},
astNode: undefined,
args: [Array]
},
GraphQLDirective {
name: 'deprecated',
description: 'Marks an element of a GraphQL schema as no longer supported.',
locations: [Array],
isRepeatable: false,
extensions: [Object: null prototype] {},
astNode: undefined,
args: [Array]
},
GraphQLDirective {
name: 'specifiedBy',
description: 'Exposes a URL that specifies the behavior of this scalar.',
locations: [Array],
isRepeatable: false,
extensions: [Object: null prototype] {},
astNode: undefined,
args: [Array]
}
],
_typeMap: [Object: null prototype] {
Emm: GraphQLObjectType {
name: 'Emm',
description: undefined,
isTypeOf: undefined,
extensions: [Object: null prototype] {},
astNode: [Object],
extensionASTNodes: [],
_fields: [Object: null prototype],
_interfaces: []
},
// omitted
```

_interfaces.maps are all undefined resulting in the observed error.

### Is there an existing issue for this?

- [X] I have searched the [issue tracker](https://www.github.com/Kong/insomnia/issues) for this problem.

### Additional Information

_No response_

### Insomnia Version

2022.2.1

### What operating system are you using?

macOS

### Operating System Version

macOS Monterey 12.3.1

### Installation method

insomnia.reset

### Last Known Working Insomnia version

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by running the supplied buildSchema reproduction with graphql ^15.8.0 and ^16.4.0, then trace Insomnia's automatic schema introspection entry point. Compare the returned schema structures and identify where the newer response causes the failure; done means introspection succeeds with the newer GraphQL server version and the regression is covered by a test.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.