mercurius-js / mercurius-gateway

Mercurius federation support plugin
MIT License
17 stars 11 forks source link

shared schemas with @external/@extends dont work #22

Open HashDot opened 3 years ago

HashDot commented 3 years ago

Hi, first of all thanks for this great project.

I am in the process of switching from Apollo Federation to Mercurius and am running into a few problems. Everything I describe here works with Apollo Federation and I would like to continue doing the same. Here's the problem:

I am using the same schemas in different services such as meta information, person, address, etc. These basic schemas are in a separate service. These schemas are then used in another service via @extends/@external and extended if necessary. Unfortunately this does not work and I always get the following feedback from the gateway:

"message": "Cannot return null for non-nullable field Meta.status."

Query:

{
  customer {
    meta {
      message
      status
    }
    data {
      _id
      name
    }
  }
}

If I do the query directly on the respective service it works. Therefore I think it is the gateway or the merging of the schemas. I have created an example repo. Can someone help me?

Example Repo: https://github.com/HashDot/federation-example

mcollina commented 3 years ago

Thanks for reporting! I currently do not have much time to diagnose this but I'm happy to review any PRs.

HashDot commented 3 years ago

Thanks for your quick reply. Then I will try another variant in the meantime and when I have time I will take a closer look. But maybe someone else has an idea what it is.

alex-parra commented 3 years ago

Hi @HashDot I've looked into your federation-example repo but as far as I can tell the graphql schemas are loaded from the vault which isn't provided.

Have you looked at the gateway example which includes @extends cross service and works as expected? What's different from your setup/needs?

The test extends-directive also implements extends cross service.

Please detail if there's a scenario not being covered by the existing tests.

HashDot commented 3 years ago

Hi @alex-parra thanks for your response. I've tried to fill in the services without the vault and the result is the same. I try to build a better and less complex example of my problem for better debugging.

alex-parra commented 3 years ago

@HashDot sounds good!