Fix health check to prevent restart loop
Browse filesAdd missing API key guard for Nebius Chat Completions check.
Now all services properly return 'missing_key' instead of 'error'
when API keys are not configured, preventing Docker health probe
failures and container restart loops.
- server/api-health-check.ts +22 -14
server/api-health-check.ts
CHANGED
|
@@ -86,20 +86,28 @@ export async function checkAPIHealth(): Promise<APIHealthStatus[]> {
|
|
| 86 |
|
| 87 |
// Check Nebius Chat Completions (DeepSeek model)
|
| 88 |
try {
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
} catch (error) {
|
| 104 |
results.push({
|
| 105 |
service: 'Nebius Chat (DeepSeek)',
|
|
|
|
| 86 |
|
| 87 |
// Check Nebius Chat Completions (DeepSeek model)
|
| 88 |
try {
|
| 89 |
+
if (!process.env.NEBIUS_API_KEY) {
|
| 90 |
+
results.push({
|
| 91 |
+
service: 'Nebius Chat (DeepSeek)',
|
| 92 |
+
status: 'missing_key',
|
| 93 |
+
message: 'NEBIUS_API_KEY environment variable not set'
|
| 94 |
+
});
|
| 95 |
+
} else {
|
| 96 |
+
const startTime = Date.now();
|
| 97 |
+
await nebiusClient.createChatCompletion({
|
| 98 |
+
model: "deepseek-ai/DeepSeek-R1-0528",
|
| 99 |
+
messages: [{ role: "user", content: "Hello" }],
|
| 100 |
+
max_tokens: 5
|
| 101 |
+
});
|
| 102 |
+
const responseTime = Date.now() - startTime;
|
| 103 |
+
|
| 104 |
+
results.push({
|
| 105 |
+
service: 'Nebius Chat (DeepSeek)',
|
| 106 |
+
status: 'healthy',
|
| 107 |
+
message: 'Successfully completed test chat with DeepSeek model',
|
| 108 |
+
responseTime
|
| 109 |
+
});
|
| 110 |
+
}
|
| 111 |
} catch (error) {
|
| 112 |
results.push({
|
| 113 |
service: 'Nebius Chat (DeepSeek)',
|