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

usePreventMutationViaGET default plugin breaks mutations via WS #1704

Closed
Tracked by #1358
qw-in opened this issue Sep 5, 2022 · 1 comment
Closed
Tracked by #1358

usePreventMutationViaGET default plugin breaks mutations via WS #1704

qw-in opened this issue Sep 5, 2022 · 1 comment
Assignees

Comments

@qw-in
Copy link

qw-in commented Sep 5, 2022

Describe the bug

Not sure if mutation over ws is something you even support. If not please disregard!

Following the WS subscriptions guide in the docs works for query & subscription. However, it breaks when attempting to run a mutation via WS.

This example: https://www.the-guild.dev/graphql/yoga-server/docs/features/subscriptions#subscriptions-over-websockets-with-graphql-ws

Results in an error here Cannot read properties of undefined (reading 'method').

if (operation.operation === 'mutation' && request.method === 'GET') {

Your Example Website or App

Can provide if needed

Steps to Reproduce the Bug or Issue

  1. Create graphql-ws integration as per docs example above.
  2. Run a mutation via the ws (use client from graphql-ws for example)
  3. Notice error

Expected behavior

I dunno, I am pretty deep in the sauce here. Not sure you want to support this. Maybe some option to disable default plugins without having to rewrite the whole server?

Screenshots or Videos

No response

Platform

  • OS: V8 isolate I guess?
  • NodeJS: Nope! Cloudflare
  • @graphql-yoga/common version(s): 2.12.11

Additional context

No response

@theguild-bot theguild-bot mentioned this issue Nov 9, 2022
@ardatan ardatan closed this as completed Nov 9, 2022
@ardatan ardatan reopened this Nov 9, 2022
@ardatan
Copy link
Collaborator

ardatan commented Nov 11, 2022

This has been fixed in v3!
We'll release v3 with bunch of improvements and features very soon. You can migrate to v3 today by following our migration guide!
https://the-guild.dev/graphql/yoga-server/v3/migration/migration-from-yoga-v2
Please let us know if you still have any issues.
Also don't forget to check our updated example for graphql-ws integration!
https://github.com/dotansimha/graphql-yoga/tree/main/examples/graphql-ws

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