Apollo-server: Uncaught ReferenceError: GraphQLPlayground is not defined at (index):537

Created on 16 May 2019  路  4Comments  路  Source: apollographql/apollo-server

Following the getting started guide (https://www.apollographql.com/docs/apollo-server/getting-started) gets me to this error, when opening the server in the browser: Uncaught ReferenceError: GraphQLPlayground is not defined at (index):537

I've tried several clean installs of the project, but I'm just getting a blank dark background page, when calling the server each time.

I hope you can help me, thanks.

Line referenced:
GraphQLPlayground.init(root, { "endpoint": "/", "subscriptionEndpoint": "/graphql", "version": "1.7.10", "canSaveConfig": false }) })

image

Most helpful comment

See this please :)

All 4 comments

See this please :)

Duplicate of #2677

Oh wow, thank you that fixed it.

Hi all!
I have the same problem.
I try to fix it, like here (https://spectrum.chat/apollo/apollo-server/graphql-playground-does-not-work-on-localhost-4000~fd431b61-5051-42f8-8bf9-c12a3ac64e10) are written, but It's not helping.
Error on index.js:

        GraphQLPlayground.init(root, {
  "endpoint": "/",
  "subscriptionEndpoint": "/graphql",
  "version": "1.7.31",
  "canSaveConfig": false
})

my index.js:

const { ApolloServer, gql } = require('apollo-server');

// The GraphQL schema
const typeDefs = gql`
  type Query {
    "A simple type for getting started!"
    hello: String
  }
`;

// A map of functions which return data for the schema.
const resolvers = {
  Query: {
    hello: () => 'world',
  },
};

const server = new ApolloServer({
  typeDefs,
  resolvers
});

server.listen().then(({ url }) => {
  console.log(`馃殌 Server ready at ${url}`);
});

package.json:

{
  "name": "apollo-graphql-server-example",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "apollo-server": "^2.9.16",
    "apollo-server-express": "^2.9.16",
    "graphql": "^14.5.8",
    "graphql-tools": "^4.0.4"
  }
}
Was this page helpful?
0 / 5 - 0 ratings