While still accepting and responding to Queries and Mutations, Apollo Server throws Status 400 in the latest RC.
e.g: https://reaction-core.staging.reactioncommerce.com/graphql-alpha
When using a separate instance of GraphQL Playground, the response is
{
"error": "Response not successful: Received status code 400"
}
and the client is unable to fetch the schema.
Querieing for example primaryShopId still works, although there is no autocomplete due to the missing schema.
@janus-reith Is there a body in the response with more information?
A simple curl https://reaction-core.staging.reactioncommerce.com/graphql-alpha
returns a proper answer,
GET query missing.%
Using chrome to navigate to https://reaction-core.staging.reactioncommerce.com/graphql-alpha I simply get an Status 400. I inspected the call in chrome Network Tools, there seems to be no response body.
I tried the same with GraphQL Playground and used the Electron DevTools there.
The difference here is that it is shown as type fetch with POST (chrome was document/GET, makes sense) and that there is a response body, while Status in the Header still is 400:
{"errors":[{"message":"GraphQL introspection is not allowed by Apollo Server, but the query contained __schema or __type. To enable introspection, pass introspection: true to ApolloServer in production","locations":[{"line":2,"column":3}],"extensions":{"code":"GRAPHQL_VALIDATION_FAILED"},"errorId":"cjsyhj530000s01o6xstrl5kc","type":"unknown"}]}
But GraphQL Playground won't show this outside of the devtools, and instead just displays as response:
{
"error": "Response not successful: Received status code 400"
}
Well, now it makes sense to me, never noticed that "hidden" body before,
Is this done on purpose on production deployments?
Oh I see. Yep, this is default behavior for production. See https://www.apollographql.com/docs/apollo-server/features/graphql-playground.html
In development, Apollo Server enables GraphQL Playground on the same URL as the GraphQL server itself (e.g. http://localhost:4000/graphql) and automatically serves the GUI to web browsers. When NODE_ENV is set to production, GraphQL Playground (as well as introspection) is disabled as a production best-practice.
It can be enabled for production as seen on that docs page I linked to, but Reaction needs to be updated to allow setting those options from ENV variables.
Created https://github.com/reactioncommerce/reaction/issues/5025 for the ENV work
Most helpful comment
Oh I see. Yep, this is default behavior for production. See https://www.apollographql.com/docs/apollo-server/features/graphql-playground.html
It can be enabled for production as seen on that docs page I linked to, but Reaction needs to be updated to allow setting those options from ENV variables.