fix: return HTTP 503 on bootstrap error for /health endpoint#1961
Open
kayjoosten wants to merge 1 commit intomainfrom
Open
fix: return HTTP 503 on bootstrap error for /health endpoint#1961kayjoosten wants to merge 1 commit intomainfrom
kayjoosten wants to merge 1 commit intomainfrom
Conversation
Uncaught exceptions thrown during bootstrap (before Symfony starts) produced a PHP fatal error page with HTTP 200. Narrow the try-catch to only the env validation block so monitoring systems receive a 503 JSON response consistent with the monitor-bundle DOWN format, without interfering with response sending or kernel termination. Closes #1936
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
public/index.phpin atry-catch(\Throwable)so misconfiguration errors (e.g. missing/shortAPP_SECRET) return HTTP 503 instead of a PHP fatal error page with HTTP 200openconext/monitor-bundleDOWN convention:{"status":"DOWN","message":"..."}error_log()so bootstrap failures still appear in server logs/healthrouteTest Plan
APP_ENV=prodandAPP_SECRET=shortin devconf.env, restart engine container, hitGET https://engine.dev.openconext.local/health— expect HTTP 503 with{"status":"DOWN","message":"APP_SECRET must be at least 32 characters long in production."}.env, restart, hit/healthagain — expect HTTP 200{"status":"UP"}./vendor/bin/phpunit --configuration=./tests/phpunit.xml --testsuite=functional --filter=MonitorControllerTest— expect 3 tests passingCloses #1936