graphql-yoga
graphql-yoga copied to clipboard
usePreventMutationViaGET default plugin breaks mutations via WS
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').
https://github.com/dotansimha/graphql-yoga/blob/049d6a06ab0b50597d2544ba1f7f35e3c562e5d8/packages/common/src/plugins/requestValidation/usePreventMutationViaGET.ts#L37
Your Example Website or App
Can provide if needed
Steps to Reproduce the Bug or Issue
- Create graphql-ws integration as per docs example above.
- Run a mutation via the ws (use client from
graphql-wsfor example) - 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/commonversion(s):2.12.11
Additional context
No response