Graphql-playground: Try to show response even if status code is 400

Created on 19 Apr 2018  路  2Comments  路  Source: graphql/graphql-playground

This issue pertains to the following package(s):

  • [x] GraphQL Playground - Electron App
  • [ ] GraphQL Playground HTML
  • [ ] GraphQL Playground
  • [ ] GraphQL Playground Express Middleware
  • [ ] GraphQL Playground Hapi Middleware
  • [ ] GraphQL Playground Koa Middleware
  • [ ] GraphQL Playground Lambda Middleware

What OS and OS version are you experiencing the issue(s) on?

macOS 10.13.4

What version of graphql-playground(-electron/-middleware) are you experiencing the issue(s) on?

v1.5.4

What is the expected behavior?

apollo-server-core responds with a 400 status code if there are errors in the request as received from the client. Playground doesn't show the server response, instead it prints:

{
  "error": "Response not successful: Received status code 400"
}

What is the actual behavior?

When it receives a response with a 400 status code, Playground ensures the response is still JSON and parses it. If it has GraphQL errors it prints them.

What steps may we take to reproduce the behavior?

Submit an invalid client request to a GraphQL server based on Apollo, e.g. pass an array variable where a string is expected.

bu2-confirmed statupr-welcome

Most helpful comment

We are using GraphQL Playground Lambda Middleware and see this behaviour in 1.5.x. 1.4.x and older work fine.

A very simple type that has a mandatory argument called like so:

query{ getUser {
  name
}}

In 1.4.x:

{
  "errors": [
    {
      "message": "Field \"getUser\" argument \"email\" of type \"String!\" is required but not provided.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ]
    }
  ]
}

In 1.5x:

{
  "error": "Response not successful: Received status code 400"
}

All 2 comments

Got same problem after upgrade prisma (older versions works fine). This error when use graphql-yoga via yarn start and graphql playground both.
Playground version 1.5.13

We are using GraphQL Playground Lambda Middleware and see this behaviour in 1.5.x. 1.4.x and older work fine.

A very simple type that has a mandatory argument called like so:

query{ getUser {
  name
}}

In 1.4.x:

{
  "errors": [
    {
      "message": "Field \"getUser\" argument \"email\" of type \"String!\" is required but not provided.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ]
    }
  ]
}

In 1.5x:

{
  "error": "Response not successful: Received status code 400"
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

jazzzz picture jazzzz  路  38Comments

acao picture acao  路  14Comments

michalkvasnicak picture michalkvasnicak  路  14Comments

lastmjs picture lastmjs  路  19Comments

freddy311082 picture freddy311082  路  14Comments