Hotchocolate: Stitching with a down endpoint

Created on 16 Oct 2019  ยท  6Comments  ยท  Source: ChilliCream/hotchocolate

Describe the bug
When creating a stitched schema, if one of the services references from the stitching is unreachable, the service will not return any requests.

To Reproduce
Steps to reproduce the behavior:

  1. Create a stitching service that references an unreachable url, and a working url.
  2. Run the service
  3. Attempt to open playground and see the services

Expected behavior
I would expect this to fallback gracefully. If one service is unreachable, It shouldn't hose the entire gateway. This functionality is preventing me from launching this into production. Ideally I don't want to take down every client talking to my graph if one of the 10 services behind it isn't responding properly. Preferably, it should still return the schema and serve requests to the graphs that it can reach.

Desktop (please complete the following information):

  • OS: Ubuntu 18.04
โ“ question

Most helpful comment

We use AddSchemaFromFile from file to handle these cases. This also gives us another useful behavior in being able to opt into a subset of the remote schema.

Ultimately if you're using AddSchemaFromHttp the stitching layer can't build a schema to return till it actually gets the remote schema, if that's down then only a partial schema could be created which is probably worse since queries expecting the full schema would fail at query validation.

All 6 comments

Hi @teevans,

you can actually do this. The schema files in this case have to be provided as files with the gateway. In this scenario the gateway would only fetch the data from the GraphQL server but not the schema.

We will add more functionality around this with version 12.

and use something like polly as a circuit breaker with your httpclient factory.

https://github.com/App-vNext/Polly

We use AddSchemaFromFile from file to handle these cases. This also gives us another useful behavior in being able to opt into a subset of the remote schema.

Ultimately if you're using AddSchemaFromHttp the stitching layer can't build a schema to return till it actually gets the remote schema, if that's down then only a partial schema could be created which is probably worse since queries expecting the full schema would fail at query validation.

@nigel-sampson

if that's down then only a partial schema could be created which is probably worse since queries expecting the full schema would fail at query validation.

Exactly the point. The schema would be unpredictable leading to issues with other GraphQL tooling.

While AddSchemaFromHttp is nice for development on a local system AddSchemaFromFile is better in production scenarios since then we can create the schema as intended.

HI @teevans,

I will close this issue since I think the question has been answered.

Thank you all so much!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sascha-andres picture sascha-andres  ยท  4Comments

jbray1982 picture jbray1982  ยท  5Comments

louisjrdev picture louisjrdev  ยท  3Comments

benmccallum picture benmccallum  ยท  3Comments

sfmskywalker picture sfmskywalker  ยท  3Comments