fazeel007 commited on
Commit
e1974ad
·
1 Parent(s): 7841477

Fix health check to prevent restart loop

Browse files

Add 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.

Files changed (1) hide show
  1. 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
- const startTime = Date.now();
90
- await nebiusClient.createChatCompletion({
91
- model: "deepseek-ai/DeepSeek-R1-0528",
92
- messages: [{ role: "user", content: "Hello" }],
93
- max_tokens: 5
94
- });
95
- const responseTime = Date.now() - startTime;
96
-
97
- results.push({
98
- service: 'Nebius Chat (DeepSeek)',
99
- status: 'healthy',
100
- message: 'Successfully completed test chat with DeepSeek model',
101
- responseTime
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)',