In production with apollo-server-express 2.0.4 Playground is visible, with 2.0.0 is not.
See original GitHub issueREPRODUCTION HERE: https://brainy-spaghetti.glitch.me
With "apollo-server-express": "2.0.4"
and NODE_ENV=production
the Playground is visible.
With "apollo-server-express": "2.0.0"
and NODE_ENV=production
I have this: GET query missing
.
Something is wrong?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Migrating to v2.0 - Apollo GraphQL Docs
If the server is only functioning as a GraphQL server, it's no longer necessary to run your own HTTP server (like express )....
Read more >Apollo Server Express - Playground cannot be reached
Server cannot be reached/no visible schema but still able to execute a query. To fix this you should have this as in your...
Read more >apollo-server-fastify | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >GraphQL: Migrating From Apollo-Server-Express 1.0 To 2.0
Body-Parser Is Baked In. Version 2.0.0 doesn't require importing the Body-Parser package, so if not needed elsewhere, you can uninstall it. 3 ...
Read more >Integrate TypeScript with GraphQL using TypeGraphQL
apollo -server-express is the express and connect integration of a ... The class-validator library allows the use of decorator and non ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Confirmed the issue. Sorry for the confusion.
https://github.com/apollographql/apollo-server/blob/412be208c1b60c2f77333eec2840b64990ea7935/packages/apollo-server-core/src/playground.ts#L39
It’s likely due to the default value of
{}
for the playground config here.The default behavior of apollo-server’s integrated graphql-playground is for it to be disabled (along with introspection queries) when
NODE_ENV=production
.This behavior can be over-ridden when you set the
playground
option in config.In 2.0.0, the graphql playground could be enabled when
NODE_ENV=production
if you explicitly set theplayground
option totrue
, but provided no way to enable the playground with a custom config object.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
playground
in production while using a custom config in your local/development environment, you could do something like this: