graphql-go-tools icon indicating copy to clipboard operation
graphql-go-tools copied to clipboard

v2 example federation not working, normalization failed

Open michaelboke opened this issue 2 years ago • 5 comments

Hi, I tried the federation example from the v2 version but unfortunately, the federation part is not really working. It will fail with a normalization failure when the query is spanning multiple subgraphs. I provided an example to reproduce. I also tried it with my services and I got the same failed response.

The following error is produced from the gateway example

ERROR   [email protected]/zap.go:82 engine.Execute  {"error": "internal: printOperation: normalization failed"}

I used the following query:

query{
  me {
    id
    username
    reviews{
      body
      author{
        id
        username
      }
    }
  }
}

I debug and traced to where the error originated from. It happens in the astnormalization.OperationNormalizer.NormalizeOperation() function will report a failure at some point with the following external error

field: reviews not defined on type: Query

These are the normalized stages (1st visit normalizeOperation)

{
    topProducts {
        upc
        name
        price
        inStock
        reviews {
            body
            author {
                id
                username
            }
        }
    }
}

2nd visit (normalizeOperation)

query($a: Int){
    topProducts(first: $a){
        upc
        name
        price
        inStock
    }
}

3th visit the one that errors (normalizeOperation)

{
    reviews {
        body
        author {
            id
            username
        }
    }
}

Please let me know if you need more information.

michaelboke avatar Dec 05 '23 21:12 michaelboke

I'm changing our gateway(which is using graphql-go-tools gateway but with v1 engine) to start using the v2 engine and I'm having the same issue.

ricardomcg avatar Dec 14 '23 12:12 ricardomcg

Struggling with this too. Is there any fix for that?

dastein1 avatar Dec 14 '23 18:12 dastein1

I have the same problem. And if you use cosmo, then https://github.com/wundergraph/cosmo/issues/442

flymedllva avatar Jan 22 '24 14:01 flymedllva

Hi everyone, the federation example in this repo is outdated and could not use v2 due to mismatched configuration requirements

We will update it soon with the v2 version

It will be available once this PR is finished

While it is not ready we suggest trying out cosmo instead

Thanks!

devsergiy avatar Jan 29 '24 16:01 devsergiy

@devsergiy any eta when the pull request will be merged?

ricardomcg avatar Feb 15 '24 10:02 ricardomcg

Hello! We are looking forward to upgrade to V2 and we are using graphql-go-tools, moving to Cosmo seems too invasive. Is there an ETA on linked PR or any plans you can share with the community @devsergiy ? Thank you!

dchukmasov avatar Mar 07 '24 10:03 dchukmasov