Error: "Must provide schema"


#1

I’m getting some really weird issue after trying to follow the GitHunt example code-structure, GraphiQL is now just complaining:

{
  "errors": [
    {
      "message": "Must provide schema"
    }
  ]
}

And all my GraphQL queries have stopped working (not surprisingly).

Yet, I can debug the code and see that I am providing a seemingly perfectly workable schema to createApolloServer():

import { createApolloServer } from 'meteor/apollo';
import executableSchema from '../imports/api/schema.js';

createApolloServer({
  executableSchema,
});
// Put schema together into one array of schema strings
// and one map of resolvers, like makeExecutableSchema expects
const schema = [...rootSchema, ...stripeSchema];
const resolvers = _.merge(rootResolvers, stripeResolvers);

const executableSchema = makeExecutableSchema({
  typeDefs: schema,
  resolvers,
});

export default executableSchema;

#2

Is graphiql pointed at the right server URL? look in the network inspector to see what requests it is trying to make.


#3

I think so! I’m just using the standard meteor-integration package, here’s the console output from GraphiQL

POST http://localhost:3000/graphql? 400 (Bad Request)

And my server startup… So yeah… think so!

/usr/local/bin/meteor --settings settings-staging.json
[[[[[ ~/Git/LabelLogicLive ]]]]]

=> Started proxy.
W20160928-16:34:00.576(1)? (STDERR) WARNING: npm peer requirements (for apollo) not installed:
W20160928-16:34:00.633(1)? (STDERR)  - apollo-server@0.3.2 installed, apollo-server@^0.2.1 needed
W20160928-16:34:00.634(1)? (STDERR)  - graphql-tools@0.7.2 installed, graphql-tools@^0.6.2 needed
W20160928-16:34:00.634(1)? (STDERR) 
W20160928-16:34:00.634(1)? (STDERR) Read more about installing npm peer dependencies:
W20160928-16:34:00.634(1)? (STDERR)   http://guide.meteor.com/using-packages.html#peer-npm-dependencies
W20160928-16:34:00.634(1)? (STDERR) 
I20160928-16:34:02.124(1)? Kadira: completed instrumenting the app
I20160928-16:34:02.244(1)? Kadira: Successfully connected
I20160928-16:34:04.489(1) (migrations_server.js:82) Migrations: Not migrating, already at version 6
I20160928-16:34:04.553(1) (synced-cron-server.js:63) SyncedCron: Scheduled "Remove all un-saved products that are older than 24 hours" next run @Wed Sep 28 2016 17:00:00 GMT+0100 (BST)
I20160928-16:34:04.554(1) (synced-cron-server.js:63) SyncedCron: Scheduled "Remove all un-saved product categories that are older than 24 hours" next run @Wed Sep 28 2016 17:00:00 GMT+0100 (BST)
I20160928-16:34:04.554(1) (synced-cron-server.js:63) SyncedCron: Scheduled "Remove all un-saved templates that are older than 24 hours" next run @Wed Sep 28 2016 17:00:00 GMT+0100 (BST)
=> Started your app.

=> App running at: http://localhost:3000/

#4


#5

This, was my error…

I renamed the schema to executableSchema, but I also use the ES6 shorthand for passing the field in. Doh!