UPDATE: apollo has updated code and docs so issue is irrelevant now
Intended outcome
start apollo-server-express using the following snippet from https://github.com/apollographql/apollo-tutorial-kit.
import express from 'express';
import { graphqlExpress, graphiqlExpress } from 'apollo-server-express';
import bodyParser from 'body-parser';
import schema from './data/schema';
const GRAPHQL_PORT = 3000;
const graphQLServer = express();
graphQLServer.use('/graphql', bodyParser.json(), graphqlExpress({ schema }));
graphQLServer.use('/graphiql', graphiqlExpress({ endpointURL: '/graphql' }));
graphQLServer.listen(GRAPHQL_PORT, () => console.log(`GraphiQL is now running on http://localhost:${GRAPHQL_PORT}/graphiql`));
Actual Outcome:
In any implementation of apollo-server-express, using docs, using https://github.com/apollographql/apollo-tutorial-kit, etc. I receive the follow stack trace over and over again:
Error: Must provide document
at invariant (~/node_modules/graphql/jsutils/invariant.js:18:11)
at Object.validate (~/node_modules/graphql/validation/validate.js:58:34)
at doRunQuery (~/node_modules/apollo-server-core/dist/runQuery.js:80:38)
at ~/node_modules/apollo-server-core/dist/runQuery.js:20:54
at <anonymous>
How to reproduce the issue:
git clone https://github.com/apollographql/apollo-tutorial-kit.git
cd apollo-tutorial-kit
yarn/npm i
npm start