File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import { errorResponse } from "@/lib/handlers/error-response";
1515import { factory } from "@/lib/hono-factory" ;
1616import { sdk } from "@/lib/instrumentation" ;
1717import logger from "@/lib/logger" ;
18+ import { publicConfigBuilder } from "@/lib/public-config-builder/singleton" ;
1819import { indexingStatusMiddleware } from "@/middleware/indexing-status.middleware" ;
1920import { generateOpenApi31Document } from "@/openapi-document" ;
2021
@@ -84,7 +85,17 @@ app.get("/openapi.json", (c) => {
8485
8586// will automatically 503 if config is not available due to ensIndexerPublicConfigMiddleware
8687app . get ( "/health" , async ( c ) => {
87- return c . json ( { message : "fallback ok" } ) ;
88+ try {
89+ // ENSApi is healthy when its Public Config can be successfully built.
90+ await publicConfigBuilder . getPublicConfig ( ) ;
91+
92+ return c . json ( { message : "fallback ok" } ) ;
93+ } catch ( error ) {
94+ logger . error ( error , "Health check failed: unable to get ENSApi Public Config" ) ;
95+
96+ // Report unhealthy status
97+ return errorResponse ( c , "Service Unavailable" , 503 ) ;
98+ }
8899} ) ;
89100
90101// log hono errors to console
You can’t perform that action at this time.
0 commit comments