Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Schema must be an instance of GraphQLSchema #1

Closed
JamesSingleton opened this issue Oct 3, 2017 · 5 comments
Closed

Schema must be an instance of GraphQLSchema #1

JamesSingleton opened this issue Oct 3, 2017 · 5 comments

Comments

@JamesSingleton
Copy link

Hello,

I recently cloned this repo to get familiar with it. However, after running npm install and npm start I get the following error:

Uncaught (in promise) Error: Network error: Schema must be an instance of GraphQLSchema. Also ensure that there are not multiple versions of GraphQL installed in your node_modules directory.

I believe this might be an issue between Apollo and GraphQL itself but I am not entirely sure. But package.json looks like this:

{
"name": "admin-on-rest-graphql-demo",
"version": "1.0.0",
"private": true,
"devDependencies": {
"babel-eslint": "^7.1.1",
"babel-polyfill": "^6.16.0",
"eslint": "^3.10.2",
"eslint-config-airbnb": "^13.0.0",
"eslint-config-airbnb-base": "^10.0.1",
"eslint-import-resolver-node": "^0.2.3",
"eslint-module-utils": "^2.0.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-react": "^6.7.1",
"fakerest": "^1.2.1",
"fetch-mock": "^5.5.0",
"gh-pages": "^0.12.0",
"react-scripts": "0.9.5"
},
"dependencies": {
"admin-on-rest": "~1.0.0",
"aor-language-french": "^1.8.0",
"aor-rich-text-input": "^1.0.0",
"aor-simple-graphql-client": "^0.0.7",
"apollo-client": "^1.2.0",
"apollo-test-utils": "^0.3.0",
"casual-browserify": "^1.5.12",
"graphql": "^0.9.6",
"graphql-tools": "^0.11.0",
"lodash.upperfirst": "^4.3.1",
"material-ui": "~0.16.4",
"pluralize": "^4.0.0",
"prop-types": "~15.5.7",
"react": "~15.5.4",
"react-dom": "~15.5.4",
"react-redux": "~5.0.4",
"react-router-dom": "~4.1.0",
"react-tap-event-plugin": "~2.0.1",
"redux-form": "~6.6.2",
"redux-saga": "~0.14.6"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"deploy": "gh-pages -d build"
},
"homepage": "http://marmelab.com/admin-on-rest-graphql-demo/"
}

I know this is just a demo but I would greatly appreciate any help. I will play around with it myself as well, I think some of the dependencies need to be updated, but if someone comes up with a conclusion/fix before me, awesome!

@JCFerrerG
Copy link

JCFerrerG commented Oct 10, 2017

I am also encountering this issue on the current master (a758655) on Window 7, npm v3.10.10, node v6.11.3, and Chromium 60.0.3112.78. The demo page seems to work well on the same browser.

Steps to reproduce

First, npm install run successfully with a few warnings. The attached npm-list.log is the output of npm list.

npm start outputs the following to the terminal:

Compiled with warnings.

Warning in ./src/apolloClient/index.js

C:\Users\drbago\Documents\Workspace\MyProject\admin-on-rest-graphql-demo\src\apolloClient\index.js
  50:54  warning  Expected '===' and instead saw '=='  eqeqeq
  67:68  warning  Expected '===' and instead saw '=='  eqeqeq

✖ 2 problems (0 errors, 2 warnings)


You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.

In the browser, the page does not seem to load, and the DevTools shows errors as pictured:
image

Other, possibly related, issues

The build produced by npm run build exhibits the same error.

Also, on this commit, npm test fails with the following output:

 FAIL  src\App.test.js
  ● Test suite failed to run

    ReferenceError: data is not defined

      at Object.<anonymous> (src\apolloClient\index.js:11:21)
      at Object.<anonymous> (src\aorApolloClient.js:4:47)
      at Object.<anonymous> (src\App.js:4:50)
      at Object.<anonymous> (src\App.test.js:3:38)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        5.537s
Ran all test suites.

@JCFerrerG
Copy link

JCFerrerG commented Oct 11, 2017

Cause of the error

In general, this error seem to be caused in a few different ways by libraries that depend on GraphQL. In this case, it seems to be through aor-simple-graphql-client -> apollo-client -> graphql.

Here are some issue reports referencing this error, which seem to fall into different categories:

aor-graphql-simple-client has been deprecated in later versions. The successor, aor-graphql, is clearly labeled as a work in progress by the developer.

How is this bug introduced?

On a higher level, I would venture to guess that this issue is introduced by a combination of bugs that creep in through the inconsistent dependency resolution of package.json. The demo might work, if the exact versions of dependencies are provided.

On a side note, this is one of the benefits of the "deterministic", "super reliable" lockfile format used in yarn.

Moving forward?

Follow the new demo in aor-graphql.

@djhi
Copy link
Contributor

djhi commented Oct 11, 2017

This demo will be deprecated soon. The aor-simple-graphql-client has already been deprecated too. All our current work on aor and gql is happening on aor-graphql, demo included

@djhi djhi closed this as completed Oct 11, 2017
@djhi
Copy link
Contributor

djhi commented Oct 11, 2017

It requires a version of admin-on-rest that has not been published

Not anymore, it works with the latest release.

Unfortunately, I'm currently on a customer project and I don't know when I will have time for this. Rest assured that the marmelab team will continue to work on it though

@JamesSingleton
Copy link
Author

Awesome! I will take a look later today. Thank you @djhi

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

No branches or pull requests

3 participants