ardatan / graphql-mesh

🕸️ GraphQL Mesh - The Graph of Everything - Federated architecture for any API service
https://the-guild.dev/graphql/mesh
MIT License
3.21k stars 329 forks source link

Mesh seems to be sending unrelated subscription query fields to subgraphs when the sub type is a union #7202

Open dpnova opened 4 days ago

dpnova commented 4 days ago

Issue workflow progress

Progress of the issue based on the Contributor Workflow

Make sure to fork this template and run yarn generate in the terminal.

Please make sure Mesh package versions under package.json matches yours.


Describe the bug

When creating a merged subscription type that is itself a union, mesh can serve the type fine when the resolvers are defined in additionalResolvers, but when they come from separate subgraph services, it errors out when you make the subscription query. See last line in this image:

image

To Reproduce Steps to reproduce the behavior:

Repro is here

use this query:

subscription {
  sync {
    __typename
    ... on Page {
      name
    }
    ... on User {
      id
    }
  }
}

Expected behavior

I would expect mesh to be able to accept the subscription request the way it does when the resolvers are defined in additionalResolvers

Environment: All relevant environment is in the codesandbox.

ardatan commented 3 days ago

I think you didn't update the Sandbox link. Could you check? Thanks for creating the issue!

dpnova commented 3 days ago

Oh sorry, first time I've used it.. Let me check

edit: ok link updated

dpnova commented 3 days ago

In my local I had added more logging to mesh and the type error seems to happen during the processing for the other subgraph if that makes sense? In my example subscription above I see the error for name while the User part of the query is happening.