Skip to content

Commit abbfd60

Browse files
andrasbacsaiclaude
andcommitted
Add debug info to upgrade-status endpoint for troubleshooting
Temporary debug fields added to identify why status returns 'none' 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f0d6ae2 commit abbfd60

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

app/Http/Controllers/Api/OtherController.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ public function upgradeStatus(Request $request)
237237

238238
$server = Server::find(0);
239239
if (! $server) {
240-
return response()->json(['status' => 'none']);
240+
return response()->json(['status' => 'none', 'debug' => 'no_server']);
241241
}
242242

243243
$statusFile = '/data/coolify/source/.upgrade-status';
@@ -251,16 +251,16 @@ public function upgradeStatus(Request $request)
251251
);
252252
$content = trim($content ?? '');
253253
} catch (\Exception $e) {
254-
return response()->json(['status' => 'none']);
254+
return response()->json(['status' => 'none', 'debug' => 'ssh_exception', 'error' => $e->getMessage()]);
255255
}
256256

257257
if (empty($content)) {
258-
return response()->json(['status' => 'none']);
258+
return response()->json(['status' => 'none', 'debug' => 'empty_content']);
259259
}
260260

261261
$parts = explode('|', $content);
262262
if (count($parts) < 3) {
263-
return response()->json(['status' => 'none']);
263+
return response()->json(['status' => 'none', 'debug' => 'invalid_parts', 'content' => $content]);
264264
}
265265

266266
[$step, $message, $timestamp] = $parts;
@@ -272,11 +272,11 @@ public function upgradeStatus(Request $request)
272272
$diffMinutes = ($now->getTimestamp() - $statusTime->getTimestamp()) / 60;
273273

274274
if ($diffMinutes > 10) {
275-
return response()->json(['status' => 'none']);
275+
return response()->json(['status' => 'none', 'debug' => 'stale', 'minutes' => $diffMinutes]);
276276
}
277277
} catch (\Exception $e) {
278278
// If timestamp parsing fails, treat as stale for security
279-
return response()->json(['status' => 'none']);
279+
return response()->json(['status' => 'none', 'debug' => 'timestamp_error', 'timestamp' => $timestamp]);
280280
}
281281

282282
// Determine status based on step

0 commit comments

Comments
 (0)