Apollo Server: 400 bad request [SOLVED]


So, I’ve fired up Apollo with an existing Express app, and used the browser to have a look at graphiql at the route I’ve set for Graphql: http://localhost:3000/graphql.

I’m using the super simple initial set up from the Apollo Server tutorial. When I refresh Graphiql, it initially returns the correct response before the second POST request fails and it returns: “message”: “Must provide query string.” along with an error in the browser console: 400: graphql:63 POST http://localhost:3000/graphql? 400 (Bad Request)

So, initially, it flashes the correct response, “it works” (form the Apollo Server tutorial) before the POST request errors out.

Has anyone else encountered this?


Have you looked in the network tab of the dev tools to see what the request and response were? That would help identify the issue.


Yea… it was an express middleware issue. Body parser seems to be causing it. Not an apollo issue per se, but this seems like it could be a common hiccup when getting started.


Oh interesting! Did you end up disabling body parser? I guess one could also make sure that body parser runs after the GraphQL middleware?

@helfer something to be aware of!


I did disable it temporarily, though I added it back with a few modifications suggested on github. No big deal.

Github issue discussing it is here.