Skip to content

Qvil Blog

[GraphQL] Error - Server cannot be reached(400), Playground introspection

graphql, apollo, strapi, heroku1 min read

  • Playground 400 error
  • Network error: Response not successful:
  • server cannot be reached
  • GraphQL introspection is not allowed by Apollo Server, graphql introspection is not allowed by apollo server but the query contained **schema or **type

What

Apollo GraphQL Production 환경에서 Playground 동작 안하는 현상

Strapi, Heroku 환경이었음.

GraphQL introspection is not allowed by Apollo Server, graphql introspection is not allowed by apollo server but the query contained schema or type

Why

Apollo Server introspection 옵션이 필요함.

introspection 옵션은 schema, docs를 분석하는 옵션임.

Production에서 introspection 옵션이 true면 보안 문제 때문에 default false

How

apolloServer.introspection: true

strapi의 경우 config/plugins.ts

1module.exports = ({ env }) => ({
2 graphql: {
3 config: {
4 playgroundAlways: true,
5 apolloServer: {
6 introspection: true,
7 },
8 },
9 },
10});

References