apollographql / apollographql/federation
Have the gateway continue to poll despite there being an error in experimental_updateSupergraphSdl
- Dominant language
- TypeScript
- Stars
- 727
- Forks
- 276
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 1
Description
Hello 👋
We're utilizing the `experimental_updateSupergraphSdl` function to have the gateway pick up any changes to the supergraph schema. This comes in handy for us in a staging environment where the gateway can be in front of subgraphs/services that have different branches deployed to constantly.
We noticed that the polling stops when there's an error in `experimental_updateSupergraphSdl`.
This can happen when the supergraph schema doesn't exist yet (on the initial boot of the gateway) or if there's a bad write to the supergraph schema file. Here is the general idea of what we have:
```
experimental_updateSupergraphSdl: async () => {
const supergraph = new Supergraph()
const sdl = await supergraph.readSdl()
return {
id: crypto.createHash('md5').update(sdl as string).digest('hex'),
supergraphSdl: sdl
}
}
```
It'd be great if the polling can continue despite there being an error or a bad `supergraphSdl`.
This would be useful for when the app is "self-healing" and has a way to compose a valid supergraph schema after the failed attempt.
Thank you!
Contributor guide
Research direction
Start at the implementation of experimental_updateSupergraphSdl and the gateway's polling loop. Reproduce the case where reading the supergraph fails or returns an invalid schema, then verify that polling continues and a later valid schema is picked up. Done means transient errors no longer stop future polling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100