Repository navigation
fix: answer ok when infra-api's /health is text/plain - #547
Merged
Merged
Conversation
infra-api answers GET /health with a 200 text/plain body. openapi-fetch's default JSON parsing threw on it, so /api/health answered 503 degraded although api was healthy. The route now reads the body as text and decides health from response.ok. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pmakanju-e2b
requested review from
Kraci,
ben-fornefeld and
drankou
as code owners
November 5, 2026 16:32
jakubno
approved these changes
Nov 5, 2026
pmakanju-e2b
pushed a commit
that referenced
this pull request
Nov 5, 2026
🤖 I have created a release *beep* *boop* --- ## [0.5.1](v0.5.0...v0.5.1) (2026-11-05) ### Bug Fixes * answer ok when infra-api's /health is text/plain ([#547](#547)) ([3758435](3758435)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: e2b-generated-code-auto-fixer[bot] <257264331+e2b-generated-code-auto-fixer[bot]@users.noreply.github.com>
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.
Why
Testing the v0.5.0 release against a real api showed
/api/healthanswering 503degradedwhile api was healthy. api answersGET /healthwith a 200text/plainbody, and openapi-fetch's default JSON parsing threw on it. The route caught the error and reported api as down.Merging this unblocks a v0.5.1 release.
Changes
src/app/api/health/route.tscallsinfra.GET('/health', { parseAs: 'text' })and decides health fromresponse.ok, so any 2xx counts as healthy. A non-ok response is still logged underhealth_check:infra_api_error, now with the responsestatusand body. Network errors are handled as before.tests/integration/health-route.test.tsno longer mocks the api client. It runs the real openapi-fetchinfraclient against a stubbed globalfetchand covers a healthy 200text/plainresponse, a 503 response and a rejected request. Each case checks the request goes tohttps://api.<domain>/health.Verification
All through bun 1.4.4:
text/plaintest fails on the original route (expected 503 to be 200) and passes with the fix.bun run check: clean (same 130 warnings asmain).bun run knip: no new findings.tsc --noEmit(afternext typegen): 0 errors.bun run test:unit: 31 files, 315 tests pass.vitest run tests/integration/withPUBLIC_E2B_DOMAIN=example.dev: 5 files, 20 tests pass.