Skip to content

Conversation

ian
Copy link

@ian ian commented Jan 31, 2022

I'm seeing an issue with fastify + mercurius where some GraphQL playgrounds / queries are getting parsed as variables = {} instead of the expected variables = undefined

Versions:

fastify 3.25.3
mercurius 9.1.0

This is most easily seen when using GraphQL Playground vs Insomnia:

Insomnia:

before buildExecutionContext {
  document: {
    kind: 'Document',
    definitions: [ [Object] ],
    loc: { start: 0, end: 46 }
  },
  variables: undefined,
  shouldCompileJit: undefined
}

vs GQL Playground (or Altair)

before buildExecutionContext {
  document: {
    kind: 'Document',
    definitions: [ [Object], [Object], [Object], [Object] ],
    loc: { start: 0, end: 1305 }
  },
  variables: {},
  shouldCompileJit: false
}

Notice the variable values are different. There's no difference in fastify implementation, just a difference with clients.

The difference in variables value is causing mercurius to blow up on document not being set inside buildExecutionContext

Copy link
Collaborator

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a unit test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants