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

Update apollo version #48

Open
lorensr opened this issue Oct 30, 2017 · 3 comments
Open

Update apollo version #48

lorensr opened this issue Oct 30, 2017 · 3 comments

Comments

@lorensr
Copy link

lorensr commented Oct 30, 2017

From "graphql-server-express": "^0.4.3" to apollo-server-express, currently at 1.2.0

@lorensr
Copy link
Author

lorensr commented Oct 30, 2017

Here is my diff from upgrading:

diff --git a/.babelrc b/.babelrc
index 9e3d274..f2e3127 100644
--- a/.babelrc
+++ b/.babelrc
@@ -1,6 +1,3 @@
 {
-  "presets": [
-    "es2015",
-    "stage-2"
-  ]
+  "presets": ["env", "stage-2"]
 }
diff --git a/package.json b/package.json
index e03aeb8..f68108f 100644
--- a/package.json
+++ b/package.json
@@ -12,7 +12,7 @@
     "babel-cli": "6.16.0",
     "babel-core": "6.17.0",
     "babel-eslint": "7.0.0",
-    "babel-preset-es2015": "6.16.0",
+    "babel-preset-env": "^1.6.1",
     "babel-preset-react": "6.16.0",
     "babel-preset-stage-2": "6.17.0",
     "babel-register": "6.16.3",
@@ -30,6 +30,7 @@
     "nodemon": "1.11.0"
   },
   "dependencies": {
+    "apollo-server-express": "^1.2.0",
+    "graphql": "^0.11.7",
+    "graphql-tools": "^2.6.1",
-    "graphql": "0.7.2",
-    "graphql-server": "^0.3.2",
-    "graphql-server-express": "^0.4.3",
-    "graphql-tools": "^0.8.2",
     "bcrypt": "^1.0.2",
     "body-parser": "1.15.2",
diff --git a/server/index.js b/server/index.js
index a722448..5b3c63b 100644
--- a/server/index.js
+++ b/server/index.js
@@ -1,5 +1,5 @@
 import express from 'express'
-import { graphqlExpress, graphiqlExpress } from 'graphql-server-express'
+import { graphqlExpress, graphiqlExpress } from 'apollo-server-express'
 import { createServer } from 'http'
 import { SubscriptionServer } from 'subscriptions-transport-ws'
 import bodyParser from 'body-parser'

It's working, but prints this error:

Name "__placeholder" must not begin with "__", which is reserved by GraphQL introspection. In a future release of graphql this will become a hard error.

And I get an error when I remove the __placeholder fields. Could do a single underscore, but then it shows up first in GraphiQL suggested field list

image

@tmeasday
Copy link
Owner

Yeah the thing is we need to have some field in the initial schema we create. Although perhaps this restriction has been lifted?

@lorensr
Copy link
Author

lorensr commented Oct 30, 2017

Still the case:

Error: Mutation fields must be an object with field names as keys or a function which returns such an object.

Guess you could, when the first type is added, eg remove type Mutation from index.js, and change eg Type.graphql from extends type Mutation to type Mutation

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

No branches or pull requests

2 participants