fix(GRO-1544): register health endpoint at /api/health not /health #52
Reference in New Issue
Block a user
Delete Branch "fix/gro-1544-api-health-endpoint"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
app.get("/health")toapi.get("/health")/api/*to the API pod; the old/healthpath was going to the web pod/api, GET /api/health fell through → 401/api/healthTest plan
GET /api/healthreturns 200 on UAT after deployUpdated UAT_PLAYBOOK.md §GRO-1485 — new health endpoint path.
cc @cpfarhood
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com
Changes Requested
CI is failing: Lint & Typecheck and Test both fail on this branch. The root cause is a
constTemporal Dead Zone error.Critical Bug:
apiused before declarationIn the submitted
src/index.ts, line ~63 calls:But
const api = app.basePath("/api")is declared ~130 lines later. Withconst, this is a Temporal Dead Zone violation — the server throwsReferenceError: Cannot access 'api' before initializationat startup.Required fix
Per the issue spec, register on
appat the full path (not onapi):Place this before the existing
app.route("/api/book", bookRouter)call. TheUAT_PLAYBOOK.mdupdate is correct — keep it unchanged.Summary
app.get("/api/health", ...)notapi.get("/health", ...)—apiis not yet in scope at that pointCI still failing — branch needs rebase onto current dev
The code change in
src/index.tsis correct:app.get("/api/health", ...)is registered onappat the full path before any auth middleware. That logic is good.Root cause of CI failure: The branch originates from
f12ec4f8(merge of PR #10 — pet profile extended fields), which predates these two dev fixes:fix: resolve pre-existing TypeScript errors for CI compliancefix: resolve pre-existing test and TypeScript errors for CI complianceSo the branch carries the old broken state of
src/__tests__/petsExtendedFields.test.tsandsrc/db/factories.ts.Failing checks:
Lint & Typecheck: TS errors insrc/__tests__/petsExtendedFields.test.ts(TS18048, TS18004) andsrc/db/factories.ts(TS2739 — missingcoatType,temperamentScore,temperamentFlags,medicalAlerts,preferredCuts).Test:src/__tests__/petsExtendedFields.test.tsfails at runtime.Fix: Rebase
fix/gro-1544-api-health-endpointonto the current dev HEAD (f55c7498). The two-commit fix from dev will resolve all the pre-existing failures, and this PR's one-line change will remain clean.UAT_PLAYBOOK.md update is acceptable.
3c49365c12to7b2b533c16LGTM. Fix is correct:
/api/healthregistered at line 62 onappdirectly (not theapisub-router), placing it beforeapi.use("*", authMiddleware)at line 193The
Build and push Reset imageCI failure is pre-existing infrastructure noise — unrelated to this 2-line path change.LGTM. Correct minimal fix — health endpoint registered at /api/health before auth middleware. Unblocks the UAT regression chain.