Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to throw error on willStart #5036

Closed
wants to merge 1 commit into from
Closed

Add option to throw error on willStart #5036

wants to merge 1 commit into from

Conversation

kuskoman
Copy link

@kuskoman kuskoman commented Mar 16, 2021

This is maybe more of a question than a suggestion.
At work we are experiencing problems with ApolloGateway- it does not crash if it is unable to connect to services on startup. I debugged it and seems that gateway is handling the error correctly- it throws it, however it's being catched in ApolloServerCore.
We solved this, and other problems by extending ApolloGateway class in our code.
Not so long ago we started using new technological stack, using Nest- and we experienced the issue even more than before. Since we now have less control of the code (if we do not want to fork graphql gateway module ofc.) it's way harder to inject own monkey patches. This behavior makes using gateway harder- we need to either catch the error earlier (for example in AuthenticatedDataSource, where we have no information about gateway/server state), or later (for example using healthchecks).
Because of it we would like to know a best way to catch these errors (or just to allow us to throw errors created during initialization).
Desired behavior seems like this:

Case 1- one or more of the services are unavailable on startup
Gateway crashes

Case 2- one of more of the services crashes after schema is already composed
Gateway handles requests which aren't related to this services

Edit: if there is other way of fixing this issue by making PR to your code I will be happy to create it if it requires reasonable amount of hours to be done.

@glasser
Copy link
Member

glasser commented Mar 16, 2021

I think you'll be happy with #4981 (currently under review, the main focus of the next minor release).

@glasser glasser closed this Mar 16, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants