mercurius-js / mercurius

Implement GraphQL servers and gateways with Fastify
https://mercurius.dev/
MIT License
2.33k stars 234 forks source link

How can I access the raw graphql of a subscription? #947

Closed wwang107 closed 1 year ago

wwang107 commented 1 year ago

Hi

We are trying to migrate our legacy graphql server to a new one written in Mercurius. Thus, I need to access the raw graphql query from the client in the service written by Mercurius, so I can forward it to our legacy graphql service.

For example, if a client sent a subscription from graphiql with the following raw query

subscription {\n something {\n id \n}}

I would like to get access to this exact string in the resolver but I can not find the description in your documentation. Is there something like this in Mercurius?

marco-ippolito commented 1 year ago

I think you can access the raw query in the preparsing hook