apollographql / federation

🌐  Build and scale a single data graph across multiple services with Apollo's federation gateway.
https://apollographql.com/docs/federation/
Other
668 stars 257 forks source link

Federation: Error when returning Query type from Mutation #2570

Open ksaldana1 opened 5 years ago

ksaldana1 commented 5 years ago

Reproduction: https://github.com/ksaldana1/provides-fed-repro/tree/query-root-failure

Issue: It is common to return the query type inside of a mutation return payload to be flexible to the downstream consumers and the type of fresh data they want from a mutation response. I have tried to implement this using a federated gateway (simple example in repro repo above), and am running into errors at the gateway level (buildQueryPlan.js specifically).

When running a simple query such as:

mutation {
  echo(input: "Hello World!") {
    message
    query {
      kitchen(id: "1") {
        id
      }
    }
  }
}

The gateway is erroring out with "message": "Couldn't find base service for type \"Query\"",. Perhaps I'm missing something in configuration of the root query object, but I was wondering if this functionality should be working.

Thanks again for your hard work!

jbaxleyiii commented 5 years ago

@ksaldana1 This is definitely not something we support yet! The query planner will need to "restart" at the query level to make this work. Definitely something we want to support

ksaldana1 commented 5 years ago

Thanks for the heads up @jbaxleyiii ! I figured as much, but thought I'd ask. Not a game-breaker and definitely doesn't trump the value proposition of federation. Plenty of other more important things to address first—my ultra flexible mutation payloads can wait a bit.

Feel free to close this issue if you plan to put it on some greater roadmap. Thanks again to you and your team for all the effort you've put into this. Excited to see what the future holds.

jbaxleyiii commented 5 years ago

@ksaldana1 I'm going to move this to our feature-requests repo!

amatiushkin commented 5 years ago

any updates on this one?

mwinstanley commented 4 years ago

+1 another request for this feature - any additional updates?

nicolas6422 commented 1 year ago

+1 Looking for an update 🙏