federation icon indicating copy to clipboard operation
federation copied to clipboard

Issue with supergraph composition when implementing multiple interfaces that have `@interfaceObject` in the same subgraph

Open nicolerenee opened this issue 2 years ago • 3 comments

Issue Description

I have found a problem generating a supergraph using rover when I have an object that implements multiple interfaces in subgraph A and then subgraph B declares both of those interfaces as @interfaceObject.

In my example supergraph-both-media-single.yml you can see that I am able to declare two interfaces in the producers subgraph and use both of them on different types in the media subgraph. So having multiple types with a @interfaceObject in the same subgraph isn't an issue. It's only if one type tries to define two interfaces that are both have a @interfaceObject implementation in the same subgraph.

Link to Reproduction

https://github.com/nicolerenee/mutliple-interface-objects

Reproduction Steps

In subgraph A declare interface I and II then create a type that implements both I and II. In subgraph B declare I and II as an @interfaceObject and add fields. Then attempt to use rover to generate a supergraph.

nicolerenee avatar May 22 '23 03:05 nicolerenee

I noticed the federation-rs repo has a v2.4.5 tag that failed to publish. I pulled it down and built it locally since that seemed to include some fixed for interfaceObjects. The results are better, but still fails:

./make-supergraphs.sh
Generating supergraph for producers-music...
⌛ resolving SDL for subgraphs defined in supergraph-music.yml
🎶 composing supergraph with Federation v2.4.5

📝 Supergraph Schema was printed to supergraph-music.graphql
Generating supergraph for producers-media...
⌛ resolving SDL for subgraphs defined in supergraph-media.yml
🎶 composing supergraph with Federation v2.4.5

📝 Supergraph Schema was printed to supergraph-media.graphql
Generating supergraph for producers-both & media-single...
⌛ resolving SDL for subgraphs defined in supergraph-both-media-single.yml
🎶 composing supergraph with Federation v2.4.5

📝 Supergraph Schema was printed to supergraph-both-media-single.graphql
Generating supergraph for producers-both & media-both...
⌛ resolving SDL for subgraphs defined in supergraph-both.yml
🎶 composing supergraph with Federation v2.4.5
error[E029]: Encountered 1 build error while trying to build a supergraph.

Caused by:
    UNKNOWN: TypeError: Cannot read properties of undefined (reading 'map')
    
        The subgraph schemas you provided are incompatible with each other. See https://www.apollographql.com/docs/federation/errors/ for more information on resolving build errors.

nicolerenee avatar May 22 '23 14:05 nicolerenee