CognxSafeTrack commited on
Commit ·
4b70b95
1
Parent(s): 9a936fa
debug: capture full stack trace on fatal startup error
Browse files- apps/api/src/index.ts +7 -2
apps/api/src/index.ts
CHANGED
|
@@ -378,8 +378,13 @@ const start = async () => {
|
|
| 378 |
startCleanupCron();
|
| 379 |
|
| 380 |
logger.info('[STARTUP] Background services initialized.');
|
| 381 |
-
} catch (err) {
|
| 382 |
-
logger.error('[STARTUP] FATAL ERROR:'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 383 |
process.exit(1);
|
| 384 |
}
|
| 385 |
};
|
|
|
|
| 378 |
startCleanupCron();
|
| 379 |
|
| 380 |
logger.info('[STARTUP] Background services initialized.');
|
| 381 |
+
} catch (err: any) {
|
| 382 |
+
logger.error('[STARTUP] ❌ FATAL ERROR DURING STARTUP:');
|
| 383 |
+
logger.error(err.message || String(err));
|
| 384 |
+
if (err.stack) logger.error(err.stack);
|
| 385 |
+
|
| 386 |
+
// Ensure logs are flushed
|
| 387 |
+
console.error('CRITICAL STARTUP ERROR:', err);
|
| 388 |
process.exit(1);
|
| 389 |
}
|
| 390 |
};
|