-
Notifications
You must be signed in to change notification settings - Fork 2k
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
apollo-server-lambda: Implement onHealthCheck
on createHandler
.
#3458
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
885b61a
Added health check for apollo-server-lambda
glenthomas bdb8c85
Set onHealthCheck parameter
glenthomas 7f7d11b
Merge branch 'master' into master
abernix 611cd81
Add CHANGELOG.md for #3458.
abernix 615dc28
Use status code 503 on `onHealthCheck` rejection, rather than 200.
abernix a330007
Merge branch 'master' into master
abernix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this status code should be 503 — do you agree?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had thought that the health check should return 200 to signal that the request completed successfully and the body inspected for a result, otherwise the 503 could mean that the health check could not be reached (which isn't really that important to know). Having considered it again I think returning a 503 on failure does make sense, some health checks may work on status code alone and I have seen that this is how it has been implemented in the other Apollo packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can certainly understand that thinking. The bit about some health check implementations relying on the status code exclusively is the most relevant. Parsing JSON responses is not functionality that all probes/tools support (or it adds too much configuration to make it worthwhile).
For the above reason, and consistency with the other Apollo implementations (and documentation clarity!) I think we should go with 503 here, unless we think that won't play nice with AWS for some reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's fine. Route 53 health checks require the endpoint to respond with an HTTP status code of 2xx or 3xx to signal healthy, so that will work.