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 to graphql 0.13.0 crashes subscriptions #162

Closed
MitkoTschimev opened this issue Feb 11, 2018 · 23 comments
Closed

Update to graphql 0.13.0 crashes subscriptions #162

MitkoTschimev opened this issue Feb 11, 2018 · 23 comments

Comments

@MitkoTschimev
Copy link

MitkoTschimev commented Feb 11, 2018

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.

@MitkoTschimev
Copy link
Author

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

@ragzor
Copy link

ragzor commented Feb 12, 2018

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

@oxy88
Copy link

oxy88 commented Feb 13, 2018

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

@schickling
Copy link
Contributor

We're looking into this! 🕵️

@zifahm
Copy link

zifahm commented Feb 14, 2018

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

@schickling
Copy link
Contributor

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

@gihrig
Copy link

gihrig commented Feb 14, 2018

@schickling Works for me! 💯

Thanks! 🎉 ✨

@lewisblackwood
Copy link

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

@niclone
Copy link

niclone commented Feb 21, 2018

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

@schickling
Copy link
Contributor

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

@schickling
Copy link
Contributor

@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.

@niclone
Copy link

niclone commented Feb 21, 2018

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

@iamclaytonray
Copy link

iamclaytonray commented Feb 21, 2018

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

@tobkle
Copy link

tobkle commented Feb 21, 2018

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

@gihrig
Copy link

gihrig commented Feb 21, 2018

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
Copy link
Contributor

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

@the-simian
Copy link

the-simian commented Feb 22, 2018

@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.

@schickling
Copy link
Contributor

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

@marktani
Copy link
Contributor

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

@johnbendi
Copy link

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

@elie222
Copy link

elie222 commented May 7, 2018

I'm also getting this issue here:
apollographql/subscriptions-transport-ws#411

@jhalborg
Copy link

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

@Urigo
Copy link
Collaborator

Urigo commented Mar 29, 2022

Hey, @Urigo from The Guild here!

You might know us from projects such as graphql-code-generator, envelop or graphql-tools.

For a long time we thought that the Javascript ecosystem is still missing a lightweight cross-platform, but still highly customizable GraphQL Server.

In the past the awesome Prisma team took on that great challenge and now we are happy to announce that we are continuing them and just released GraphQL Yoga 2.0 - Build fast, extensible, and batteries-included (Subscriptions, Serverless, File uploads support) GraphQL APIs in Node.js 🚀

We have been working a long time on version 2.0 and have been using it in our clients projects for a few months now and shared a couple of alpha cycles here.
Thank you all for your feedback and suggestions, you made this release possible!

Please try Yoga out again, give us feedback and help us spread the word on the new release!

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