Apollo-server: Example doesn't work

Created on 17 Dec 2017  路  7Comments  路  Source: apollographql/apollo-server

The end-to-end example showed in the documentation doesn't work.

If I run any query I get this error

{
  "errors": [
    {
      "message": "graphql_1.execute(...).then is not a function"
    }
  ]
}

STEPS TO REPRODUCE:

  • follow the steps in the example (install module, run code)
  • open graphiql
  • run any query

POSSIBLE REASON
Implementing resolvers as promises solves the issue, but that's not a good solution, because I cannot reimplement the introspection query

All 7 comments

@ZaninAndrea You'd have to use graphql version 0.11.7 or earlier. Graphql released new version which is causing this issue

Thanks a lot, maybe it's worth changing the install script in the example to

npm install --save apollo-server-express graphql-tools [email protected] express body-parser

Glad to help. BTW issue already open #718 :)

I believe this has been fixed in 1.3.1.

I get this exact problem with apollo-server-koa 1.3.2.

Getting all tools (server, client, codegen etc.) to agree on a singular version of the graphql package is difficult but necessary as it has classes that are checked with instanceof. So it would be nice if more versions of the graphql package could be supported in apollo-server.

Upgraded graphql-tools to 2.16.0 and now it works :-).

Thanks salhotra, i was stuck for almost 4 hours on this problem

Was this page helpful?
0 / 5 - 0 ratings