Enabling graphql queries in production (Error: Server cannot be reached)

System Information
  • Strapi Version: 4.1.7
  • Operating System: Windows 11
  • Node Version: 16.14.0
  • NPM Version: 8.3.1
  • Yarn Version: – – –

Hi!
I have an issue with configuring graphql queries in production. I followed steps from Strapi docs:
https://docs.strapi.io/developer-docs/latest/plugins/graphql.html#configurations
And the playground works, but I have an error 400 which does not allow me
to display DOCS and SCHEMA (on the right side).

I don’t know where is the problem.
I would be grateful if anyone will be able to give me some hint or solution.
Just to remind you, this is Strapi in production mode.

2 Likes

Same problem here. I clicked on settings and noticed that the server for testing is set to localhost.

I changed to my heroku domain with no success.

I have the same issue

Hello guys. The solution is to create a new file in the directory config/env/production.

// ./config/env/production/plugins.js

module.exports = {
  graphql: {
    config: {
      endpoint: '/graphql',
      shadowCRUD: true,
      playgroundAlways: true,
      depthLimit: 10,
      amountLimit: 100,
      apolloServer: {
        tracing: false,
        introspection: true,
      },
    },
  },
};

Reference https://github.com/strapi/strapi/issues/9105#issuecomment-1080073060

3 Likes

Yeah, that’s solved my issue, thanks :slight_smile: