Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a new Apollo Server throws an error #1340

Closed
jesstelford opened this issue Jun 26, 2019 · 1 comment · Fixed by #1341
Closed

Creating a new Apollo Server throws an error #1340

jesstelford opened this issue Jun 26, 2019 · 1 comment · Fixed by #1341
Assignees

Comments

@jesstelford
Copy link
Contributor

jesstelford commented Jun 26, 2019

❯ npm init keystone-app my-ks-app && cd my-ks-app && yarn start

╦╔═ ╔═╗ ╦ ╦ ╔═╗ ╔╦╗ ╔═╗ ╔╗╔ ╔═╗  ╦ ╔═╗
╠╩╗ ║╣  ╚╦╝ ╚═╗  ║  ║ ║ ║║║ ║╣   ║ ╚═╗
╩ ╩ ╚═╝  ╩  ╚═╝  ╩  ╚═╝ ╝╚╝ ╚═╝ ╚╝ ╚═╝

  ✔ Check ./my-ks-app
  ✔ Create KeystoneJS Project
  ✔ Install dependencies with Yarn

🎉 KeystoneJS app created in ./my-ks-app

Get started:

cd ./my-ks-app
yarn start

Next steps:

- Edit ./my-ks-app/index.js to customize your app.
- Open the Admin UI
- Read the docs
- Star KeystoneJS on GitHub

yarn run v1.15.2
$ cross-env NODE_ENV=development DISABLE_LOGGING=true keystone
ℹ Command: keystone dev
✔ Validated project entry file ./index.js
✔ Keystone server listening on port 3000
✔ Initialised Keystone instance
✖ Connecting to database
TypeError: Cannot read property 'some' of undefined
    at typeDefs.some.typeDef (node_modules/apollo-server-core/dist/utils/isDirectiveDefined.js:9:57)
    at Array.some (<anonymous>)
    at Object.exports.isDirectiveDefined (node_modules/apollo-server-core/dist/utils/isDirectiveDefined.js:9:21)
    at new ApolloServerBase (node_modules/apollo-server-core/dist/ApolloServer.js:146:39)
    at new ApolloServer (node_modules/apollo-server-express/dist/ApolloServer.js:46:9)
    at createApolloServer (node_modules/@keystone-alpha/app-graphql/lib/apolloServer.js:145:18)
    at GraphQLApp.prepareMiddleware (node_modules/@keystone-alpha/app-graphql/index.js:46:20)
    at Promise.all.filter.map.app (node_modules/@keystone-alpha/keystone/lib/Keystone/index.js:434:17)
    at Array.map (<anonymous>)
    at Keystone.prepare (node_modules/@keystone-alpha/keystone/lib/Keystone/index.js:433:12)
    at executeDefaultServer (node_modules/@keystone-alpha/keystone/bin/utils.js:106:42)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Looks like this bug is from Apollo: apollographql/apollo-server#2921

We're returning strings here:
https://github.com/keystonejs/keystone-5/blob/5e56bc4d4754ca4242b8f1d4cb6b819873a3254e/packages/keystone/lib/Keystone/index.js#L152

Perhaps we should wrap them in gql calls where it's passed to Apollo here: https://github.com/keystonejs/keystone-5/blob/master/packages/app-graphql/lib/apolloServer.js#L149

@jesstelford jesstelford self-assigned this Jun 26, 2019
jesstelford added a commit that referenced this issue Jun 26, 2019
Apollo released a breaking change in a semver-minor which causes it to
stop understanding the SDL (string) GraphQL typeDefs we were passing it.
This fix ensures we're converting to an AST to avoid the error being
thrown.

See apollographql/apollo-server#2921

Fixes #1340
jesstelford added a commit that referenced this issue Jun 26, 2019
Apollo released a breaking change in a semver-minor which causes it to
stop understanding the SDL (string) GraphQL typeDefs we were passing it.
This fix ensures we're converting to an AST to avoid the error being
thrown.

See apollographql/apollo-server#2921

Fixes #1340
jesstelford added a commit that referenced this issue Jun 26, 2019
Apollo released a breaking change in a semver-minor which causes it to
stop understanding the SDL (string) GraphQL typeDefs we were passing it.
This fix ensures we're converting to an AST to avoid the error being
thrown.

See apollographql/apollo-server#2921

Fixes #1340
@jesstelford
Copy link
Contributor Author

Fix released in @keystone-alpha/[email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant