process.env.NODE_ENV !== 'production'
and this may not be set in Netlify, the GraphQL playground could be exposed.
export const createGraphQLHandler = ({
context,
getCurrentUser,
onException,
cors,
onHealthCheck,
...options
}: GraphQLHandlerOptions = {}) => {
const isDevEnv = process.env.NODE_ENV !== 'production'
const handler = new ApolloServer({
// Turn off playground, introspection and debug in production.
debug: isDevEnv,
introspection: isDevEnv,
playground: isDevEnv,
Issue at hand is the Netlify Build vs Runtime environment. You will have to explicitly set NODE_ENV as a Netlify environment variable in their admin UI.
While
https://github.com/redwoodjs/redwood/blob/895c2d09552e30138a9da09d447caea353f2a5ca/packages/api/src/functions/graphql.ts#L90
does turn off the
playgroundif in dev mode, because it relies onprocess.env.NODE_ENVand this may not be set in Netlify, the GraphQL playground could be exposed.
How to fix?
process.env.NODE_ENVis set? (edit: nope ...)GRAPHQL_PLAYGROUND_ENABLEDenv set only in dev and check that value for enabling the playgroundNotes:
https://community.netlify.com/t/node-env-is-undefined-in-lambda-functions-no-matter-what-i-do/20667/2
Issue at hand is the Netlify Build vs Runtime environment. You will have to explicitly set
NODE_ENVas a Netlify environment variable in their admin UI.