Graphql playground stuck at loading when accessing my server in heroku

2.1k views Asked by At

I deployed a simple apollo grapqhl server to heroku (http://filex-database.herokuapp.com) but when I try to access the playground on my main machine the playground doesn't load and gets stuck at Loading Screen. The playground loads perfectly when I run the server locally.

The same heroku server works fine if I access it from my laptop though (and even another browser in my machine).

Maybe it's something to do with Chrome. But I donĀ“t know where to start debugging.

1

There are 1 answers

0
nitame On

I have faced this same problem recently.

After some research, it appears that I have to set some ENV VAR in order to correctly run GraphQL playground. On Heroku, I set the following:

GRAPHQL_PLAYGROUND_ENABLED=true
NODE_ENV=development
PRODUCTION=false

After that, I rerun the dynos of the app, and the playground loaded correctly.

From my understanding, it is not a good practice to serve GraphQL playground in production environment. So take care of flipping the ENV VAR for production, or even build an app for development, and another for production.

Hope it could help.