graphql-yoga: Update to graphql 0.13.0 crashes subscriptions

Update:

Add the following to your package.json and run yarn install. This should fix the problem:

  "resolutions": {
    "graphql": "0.13.1"
  }

After updating to graphql-yoga to 1.2.5 subscriptions are not working anymore because of duplicated graphql version. And a lot of warnings are throwing on yarn installation -> i think that the deps are not compatible with 0.13.0

warning "graphql-yoga > apollo-upload-server@4.0.0-alpha.3" has incorrect peer dependency "graphql@0.11 - 0.12".
warning "graphql-yoga > graphql-subscriptions@0.5.6" has incorrect peer dependency "graphql@^0.10.5 || ^0.11.3 || ^0.12.0".
warning "graphql-yoga > graphql-tools@2.18.0" has incorrect peer dependency "graphql@^0.11.0 || ^0.12.0".
warning "graphql-yoga > subscriptions-transport-ws@0.9.5" has incorrect peer dependency "graphql@^0.10.0 || ^0.11.0 || ^0.12.0".
warning "graphql-yoga > apollo-server-express > apollo-server-core@1.3.2" has incorrect peer dependency "graphql@^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0".
warning "graphql-yoga > apollo-server-express > apollo-server-core > apollo-cache-control@0.0.9" has incorrect peer dependency "graphql@^0.10.0 || ^0.11.0 || ^0.12.0".
warning "graphql-yoga > apollo-server-express > apollo-server-core > apollo-tracing@0.1.3" has incorrect peer dependency "graphql@^0.10.0 || ^0.11.0 || ^0.12.0".
warning "graphql-yoga > apollo-server-express > apollo-server-core > graphql-extensions@0.0.7" has incorrect peer dependency "graphql@^0.10.0 || ^0.11.0 || ^0.12.0".

Cannot use GraphQLSchema “[object Object]” from another module or realm.↵↵Ensure that there is only one instance of “graphql” in the node_modules↵directory. If different versions of “graphql” are the dependencies of other↵relied on modules, use “resolutions” to ensure only one version is installed.↵↵https://yarnpkg.com/en/docs/selective-version-resolutions↵↵Duplicate “graphql” modules cannot be used at the same time since different↵versions may have different capabilities and behavior. The data from one↵version used in the function from another could produce confusing and↵spurious results.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 4
  • Comments: 23 (7 by maintainers)

Most upvoted comments

For everyone still having problems with this, please try the following things if the error still appears:

  • yarn upgrade-interactive --latest and make sure you’re running the newest version of the following packages (if used)
    • prisma-binding
    • graphql-yoga
    • prisma
    • graphql-cli
  • rm -rf node_modules
  • yarn install

This issue is still happening for me with yarn version 1.6.0 even with the resolutions fix.

But this works:

yarn upgrade-interactive --latest rm -rf node_modules npm install yarn dev

Sounds like you may need to clear yarn’s cache

yarn cache clean

@schickling Works for me! 💯

Thanks! 🎉 ✨

By now all packages have been updated, so with the newest package versions this should now work even without the resolutions addition.

After a rollback to a previous version it works again my entries in the working version of package.json

"dependencies": {
    "aws-lambda": "^0.1.2",
    "aws-sdk": "2.192.0",
    "bcryptjs": "2.4.3",
    "graphql-yoga": "1.2.4",
    "jsonwebtoken": "8.1.1",
    "prisma-binding": "1.5.7"
  },
  "devDependencies": {
    "@types/bcryptjs": "2.4.1",
    "dotenv-cli": "1.4.0",
    "graphql-cli": "2.13.2",
    "nodemon": "1.14.12",
    "npm-run-all": "4.1.2",
    "prisma": "1.1.3",
    "rimraf": "2.6.2",
    "ts-node": "4.1.0",
    "typescript": "2.6.2"
  }

For anyone still running into this, upgrading yarn from 0.27.5 to 1.3.2 fixed it for me.