apollographql / apollographql/federation

support notification when loading managed schema config fails

Open
#289 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
725
Forks
276
Avg merge
1h 47m
Merged PRs (30d)
1

Description

As far as I can tell from the source and my own experimentation, there is no easy way (in the code) to be notified when fetching the managed schema from Studio fails. Using the gateway as intended, the schema config is fetched asynchronously from the `ApolloServer` constructor, which means there is no way to catch the promise rejection. In practice, this results in the server starting up in a bad state (no schema) without exiting and with no way to recover (since the schema config polling isn't started). Ideally, there would be an easy way to catch any schema fetching errors or at least have a callback (e.g. `onGatewayLoadFailure`).

It looks like I could call `gateway.load()` manually, before constructed the server. However, the `apollo` config option (needed for managed graphs) has required keys (e.g. `keyHash`) that are determined by `ApolloServer` and would be difficult to extract on my own (without digging into the internals of the server).

Am I missing something? I found https://github.com/apollographql/apollo-server/issues/4435, but there is no mention of workarounds.

Contributor guide

Open the contributing guide

Research direction

Start by reading the ApolloServer constructor and the gateway.load() path described in the issue, then compare the related Apollo Server issue 4435. Determine how managed schema fetch failures are surfaced and what callback or error-handling contract is needed; done means callers can reliably detect the failure and recover or exit.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.