1
How to disable graphql introspection
Sumit Man
I am trying to disable introspection on graphql queries through strapi. I added the configuration in config/plugin.js
graphql: {
endpoint: "/graphql",
tracing: false,
shadowCRUD: true,
playgroundAlways: false,
depthLimit: 7,
amountLimit: 100,
apolloServer: {
introspection: false,
},
},
But this has no effect at all
Shaun Brown
Hi Sumit Man could you try the following code instead? Also please feel free to open issues in the documentation GitHub repo for this sort of thing in the future.
introspection: process.env.NODE_ENV !== 'production'
You could change the node env to development if you want it off in dev mode I think. I pulled this from: https://www.apollographql.com/docs/apollo-server/api/apollo-server/#options
Sumit Man
Shaun Brown: Thank you for the response Shaun.
Apologies I thought the answer will be straight forward and doesnt need to be an issue on github, but now I did create a ticket. Moving the conversation to https://github.com/strapi/documentation/issues/1400
Yes I saw this statement in the documentation as well, but its just to set true/false based on the environment. I want to explicitly set it as false for introspection to be disabled in all environments.