-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In production with apollo-server-express 2.0.4 Playground is visible, with 2.0.0 is not. #1571
Comments
cc @nderscore @evans |
The default behavior of apollo-server's integrated graphql-playground is for it to be disabled (along with introspection queries) when This behavior can be over-ridden when you set the In 2.0.0, the graphql playground could be enabled when In 2.0.2, this was adjusted to allow a custom config to enable the playground in production. Now, a truthy value will enable the playground, while a falsey value will disable it. If you want to disable the const GRAPHQL_PLAYGROUND_CONFIG = {
folderName: 'Foo',
settings: {
'editor.cursorShape': 'line',
'editor.fontSize': 14,
'editor.reuseHeaders': true,
'editor.theme': 'dark'
}
};
const server = new ApolloServer({
playground: process.env.NODE_ENV === 'production' ? false : GRAPHQL_PLAYGROUND_CONFIG,
schema: mySchema
}); |
I'm not using any custom config as you can see. I think it is bad if playground is enabled by default in production. Isn't it? |
I'm not familiar with glitch.me, but I figured out where I can actually find the source code. 😄 https://glitch.com/~brainy-spaghetti In this case, you're setting To be honest, I'm not sure if/what conventions exist for how to handle an unset or empty The best practice would probably be to always explicitly set your |
@nderscore I'm sorry, I think glitch doesn't show the value of .env file keys to the public internet. It is Can you try on your PC downloading the file from glitch? |
Confirmed the issue. Sorry for the confusion.
It's likely due to the default value of |
Is there a test for this? |
I have the same problem with "apollo-server-express": "2.1.0". Older project with |
Just realised the problem is playground. So for now the workaround is |
@tsvetann const server = new ApolloServer({
typeDefs,
resolvers,
playground: process.env.NODE_ENV !== "production",
}); |
I believe this is resolved, but I realize it's been quite some time since you opened this, so if you haven't already figured this out, I'd recommend taking this question to the Apollo community on Spectrum.chat to discuss it further. Feel free to comment here as well! Thanks! |
REPRODUCTION HERE: https://brainy-spaghetti.glitch.me
With
"apollo-server-express": "2.0.4"
andNODE_ENV=production
the Playground is visible.With
"apollo-server-express": "2.0.0"
andNODE_ENV=production
I have this:GET query missing
.Something is wrong?
The text was updated successfully, but these errors were encountered: