wundergraph / cosmo

The open-source solution to building, maintaining, and collaborating on GraphQL Federation at Scale. The alternative to Apollo Studio and GraphOS.
https://cosmo-docs.wundergraph.com/
Apache License 2.0
742 stars 105 forks source link

Router does not serve __type field as part of an Introspection query #1245

Open danielreynolds1 opened 1 month ago

danielreynolds1 commented 1 month ago

Component(s)

router

Component version

0.110.1, 0.118.0

wgc version

0.62.0

controlplane version

0.104.0

router version

0.110.1, 0.118.0

What happened?

Description

When I try to make an IntrospectionQuery using StrawberryShake (.NET client), the .NET code cannot parse the result. The query looks like:

query IntrospectionQuery {
  __type(name: "__Schema") {
    fields {
      name
    }
  }
}

The result comes back from the router as:

{
  "data": {
    "__type": null
  }
}

Steps to Reproduce

I have reproduced this using multiple versions of the Router. I believe it is completely agnostic of the subgraphs within the system.

This should be reproducible on the code found in the demo.

Expected Result

Based on an alternative Federated router implementation, I would expect the result to be:

{
  "data": {
    "__type": {
      "fields": [
        {
          "name": "description"
        },
        {
          "name": "types"
        },
        {
          "name": "queryType"
        },
        {
          "name": "mutationType"
        },
        {
          "name": "subscriptionType"
        },
        {
          "name": "directives"
        }
      ]
    }
  }
}

Environment information

No response

Router configuration

No response

Router execution config

No response

Log output

No response

Additional context

Apollo Router produced the expected result above, as did the graphql-yoga server. I assume it is a part of the intended GraphQL spec?

github-actions[bot] commented 1 month ago

WunderGraph commits fully to Open Source and we want to make sure that we can help you as fast as possible. The roadmap is driven by our customers and we have to prioritize issues that are important to them. You can influence the priority by becoming a customer. Please contact us here.

StarpTech commented 1 month ago

Hi @danielreynolds1, thanks for opening the issue. We'll take a look and come back to you.

devsergiy commented 1 month ago

Hi @danielreynolds1

We intentionally do not include information from the internal graphql types Could you explain your use case? Why do you need that?

danielreynolds1 commented 1 month ago

Hi,

As mentioned in the original post, the call is made by StrawberryShake as this is how it builds its introspected schema. I don’t know why it does it that way, other introspection queries work for us.

The docs can be found here: https://chillicream.com/docs/strawberryshake/v13

We use the library in various Server and Desktop applications and it would be nice if we could do the introspection to acquire the schema. The workaround for now has been to download the schema from studio and put this alongside the project (so it doesn’t automatically download it from the server).

The StrawberryShake introspection has worked with other routers, so I was surprised to see the query returning null for __Type!

devsergiy commented 1 month ago

Thanks for the report and the detailed explanation we will schedule a fix for this issue