Graphql-yoga: Update to graphql 0.13.0 crashes subscriptions

Created on 11 Feb 2018  Â·  22Comments  Â·  Source: dotansimha/graphql-yoga

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 > [email protected]" has incorrect peer dependency "[email protected] - 0.12".
warning "graphql-yoga > [email protected]" has incorrect peer dependency "graphql@^0.10.5 || ^0.11.3 || ^0.12.0".
warning "graphql-yoga > [email protected]" has incorrect peer dependency "graphql@^0.11.0 || ^0.12.0".
warning "graphql-yoga > [email protected]" has incorrect peer dependency "graphql@^0.10.0 || ^0.11.0 || ^0.12.0".
warning "graphql-yoga > apollo-server-express > [email protected]" 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 > [email protected]" has incorrect peer dependency "graphql@^0.10.0 || ^0.11.0 || ^0.12.0".
warning "graphql-yoga > apollo-server-express > apollo-server-core > [email protected]" has incorrect peer dependency "graphql@^0.10.0 || ^0.11.0 || ^0.12.0".
warning "graphql-yoga > apollo-server-express > apollo-server-core > [email protected]" 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.

Most helpful comment

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

All 22 comments

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"
  }

Same Issue.

"dependencies": {
"bcryptjs": "2.4.3",
"graphql-yoga": "^1.2.5",
"jsonwebtoken": "8.1.0",
"prisma-binding": "^1.5.9"
},
"devDependencies": {
"dotenv": "4.0.0",
"nodemon": "1.14.10"
}

Same. I had to add resolutions [email protected] in package.json and subscriptions don't work correctly

We're looking into this! 🕵️

getting a similar error here https://imgur.com/a/nMqHG

Can you all please try to update prisma-binding to the latest version? This should fix the issue.

@schickling Works for me! đź’Ż

Thanks! 🎉 ✨

đź‘‹I'm seeing the same error using the typescript-advanced Prisma boilerplate, with latest versions installed.

My dependencies look like this:

"dependencies": {
  "bcryptjs": "2.4.3",
  "graphql-yoga": "1.3.3",
  "jsonwebtoken": "8.1.1",
  "prisma-binding": "1.5.12"
},
"devDependencies": {
  "@types/bcryptjs": "2.4.1",
  "dotenv-cli": "1.4.0",
  "graphql-cli": "2.14.2",
  "nodemon": "1.15.1",
  "npm-run-all": "4.1.2",
  "prisma": "1.2.4",
  "rimraf": "2.6.2",
  "ts-node": "4.1.0",
  "typescript": "2.7.2"
}

Hi,

I had the same problem, finally solved by removing yarn (sudo npm remove -g yarn) before prisma init, and then install it again (sudo npm install -g yarn) before "yarn dev"...

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

@niclone glad it works for you now, reinstalling yarn should actually not be necessary.

Hopefully this all will go a lot smoother for future graphql releases.

@schickling : resintall yarn is not the solution, the solution is to have it UNINSTALLED during prisma init.

I wish I could find the relevant issue but I haven't been able to find it...

From what I remember, the issue is that Yarn tries to install graphql multiple times, at different versions. You'll find that rm -rf node_modules && npm i works perfectly, regardless of what graphql version you have. I'll try to find it again, again

Also, from what I remember, it also has to do with setting graphql as a dep instead of peer dep, which causes multiple versions of graphql being installed and breaking

This doesn't work:

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

I'm still getting the duplicate graphql error.

But this works:

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

or you add to package.json:

"resolutions": {
    "graphql": "^0.13.0"
}

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

Thanks for pointing this out @tobkle. Add the following to your package.json and run yarn install. This should fix the problem:

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

@schickling I am still getting this very issue, even after adding the resolutions property to the package.json.

The only thing that worked for me was downgrading to 1.2.4, anything higher would always cause the issue.

I also had to use npm -i instead of yarn as well.

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

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

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

Getting this issue after using typescript-advanced boilerplate and following part 1 of the guide for deploying with now. I then realized that I needed to check out part two as well. Deploying with now --dotenv .env worked

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CaptainChemist picture CaptainChemist  Â·  4Comments

AhmadEl-Banna picture AhmadEl-Banna  Â·  5Comments

playerx picture playerx  Â·  5Comments

ramonmulia picture ramonmulia  Â·  3Comments

ahmedosama5200 picture ahmedosama5200  Â·  4Comments