Skip to content

fix: answer ok when infra-api's /health is text/plain - #547

Merged
pmakanju-e2b merged 1 commit into
mainfrom
fix-health-text-plain
Nov 5, 2026
Merged

pmakanju-e2b merged 1 commit into
mainfrom
fix-health-text-plain

Conversation

@pmakanju-e2b

@pmakanju-e2b pmakanju-e2b commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Why

Testing the v0.5.0 release against a real api showed /api/health answering 503 degraded while api was healthy. api answers GET /health with a 200 text/plain body, 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

  • Route: src/app/api/health/route.ts calls infra.GET('/health', { parseAs: 'text' }) and decides health from response.ok, so any 2xx counts as healthy. A non-ok response is still logged under health_check:infra_api_error, now with the response status and body. Network errors are handled as before.
  • Test: tests/integration/health-route.test.ts no longer mocks the api client. It runs the real openapi-fetch infra client against a stubbed global fetch and covers a healthy 200 text/plain response, a 503 response and a rejected request. Each case checks the request goes to https://api.<domain>/health.

Verification

All through bun 1.4.4:

  • The healthy text/plain test fails on the original route (expected 503 to be 200) and passes with the fix.
  • bun run check: clean (same 130 warnings as main).
  • bun run knip: no new findings.
  • tsc --noEmit (after next typegen): 0 errors.
  • bun run test:unit: 31 files, 315 tests pass.
  • vitest run tests/integration/ with PUBLIC_E2B_DOMAIN=example.dev: 5 files, 20 tests pass.

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>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

@pmakanju-e2b
pmakanju-e2b merged commit 3758435 into main Nov 5, 2026
10 checks passed
@pmakanju-e2b
pmakanju-e2b deleted the fix-health-text-plain branch November 5, 2026 17:19
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants