Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(api): health returns 503 instead of 500

Marc Klingen75f2ae5f1022
diff --git a/fern/apis/server/definition/health.yml b/fern/apis/server/definition/health.yml
index ea8da3b219..7acfa616a8 100644
--- a/fern/apis/server/definition/health.yml
+++ b/fern/apis/server/definition/health.yml
@@ -8,8 +8,8 @@ service:
method: GET
path: /health
errors:
- - InternalServerError
+ - ServiceUnavailableError
errors:
- InternalServerError:
- status-code: 500
+ ServiceUnavailableError:
+ status-code: 503
diff --git a/generated/openapi-server/openapi.yml b/generated/openapi-server/openapi.yml
index e830ebc386..c777eba69b 100644
--- a/generated/openapi-server/openapi.yml
+++ b/generated/openapi-server/openapi.yml
@@ -452,7 +452,7 @@ paths:
application/json:
schema:
type: string
- '500':
+ '503':
description: ''
/api/public/ingestion:
post:
diff --git a/src/pages/api/public/health.ts b/src/pages/api/public/health.ts
index 4aceb91836..ce5676ae79 100644
--- a/src/pages/api/public/health.ts
+++ b/src/pages/api/public/health.ts
@@ -10,7 +10,7 @@ export default async function handler(
try {
await prisma.$queryRaw`SELECT 1;`;
} catch (e) {
- return res.status(500).json({ status: "Database not available" });
+ return res.status(503).json({ status: "Database not available" });
}
return res.status(200).json({ status: "OK" });
}