@friggframework/core 2.0.0--canary.419.6e5f240.0 → 2.0.0--canary.419.29d9541.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/handlers/routers/health.js +28 -1
- package/package.json +5 -5
|
@@ -15,7 +15,7 @@ const validateApiKey = (req, res, next) => {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
if (!apiKey || apiKey !== process.env.HEALTH_API_KEY) {
|
|
18
|
-
console.
|
|
18
|
+
console.error('Unauthorized access attempt to health endpoint');
|
|
19
19
|
return res.status(401).json({
|
|
20
20
|
status: 'error',
|
|
21
21
|
message: 'Unauthorized',
|
|
@@ -387,6 +387,8 @@ router.get('/health', async (_req, res) => {
|
|
|
387
387
|
});
|
|
388
388
|
|
|
389
389
|
router.get('/health/detailed', async (_req, res) => {
|
|
390
|
+
// eslint-disable-next-line no-console
|
|
391
|
+
console.log('Starting detailed health check');
|
|
390
392
|
const startTime = Date.now();
|
|
391
393
|
const response = buildHealthCheckResponse(startTime);
|
|
392
394
|
|
|
@@ -396,12 +398,16 @@ router.get('/health/detailed', async (_req, res) => {
|
|
|
396
398
|
if (!dbState.isConnected) {
|
|
397
399
|
response.status = 'unhealthy';
|
|
398
400
|
}
|
|
401
|
+
// eslint-disable-next-line no-console
|
|
402
|
+
console.log('Database check completed:', response.checks.database);
|
|
399
403
|
} catch (error) {
|
|
400
404
|
response.checks.database = {
|
|
401
405
|
status: 'unhealthy',
|
|
402
406
|
error: error.message,
|
|
403
407
|
};
|
|
404
408
|
response.status = 'unhealthy';
|
|
409
|
+
// eslint-disable-next-line no-console
|
|
410
|
+
console.log('Database check error:', error.message);
|
|
405
411
|
}
|
|
406
412
|
|
|
407
413
|
try {
|
|
@@ -409,12 +415,16 @@ router.get('/health/detailed', async (_req, res) => {
|
|
|
409
415
|
if (response.checks.encryption.status === 'unhealthy') {
|
|
410
416
|
response.status = 'unhealthy';
|
|
411
417
|
}
|
|
418
|
+
// eslint-disable-next-line no-console
|
|
419
|
+
console.log('Encryption check completed:', response.checks.encryption);
|
|
412
420
|
} catch (error) {
|
|
413
421
|
response.checks.encryption = {
|
|
414
422
|
status: 'unhealthy',
|
|
415
423
|
error: error.message,
|
|
416
424
|
};
|
|
417
425
|
response.status = 'unhealthy';
|
|
426
|
+
// eslint-disable-next-line no-console
|
|
427
|
+
console.log('Encryption check error:', error.message);
|
|
418
428
|
}
|
|
419
429
|
|
|
420
430
|
const { apiStatuses, allReachable } = await checkExternalAPIs();
|
|
@@ -422,15 +432,24 @@ router.get('/health/detailed', async (_req, res) => {
|
|
|
422
432
|
if (!allReachable) {
|
|
423
433
|
response.status = 'unhealthy';
|
|
424
434
|
}
|
|
435
|
+
// eslint-disable-next-line no-console
|
|
436
|
+
console.log('External APIs check completed:', response.checks.externalApis);
|
|
425
437
|
|
|
426
438
|
try {
|
|
427
439
|
response.checks.integrations = checkIntegrations();
|
|
440
|
+
// eslint-disable-next-line no-console
|
|
441
|
+
console.log(
|
|
442
|
+
'Integrations check completed:',
|
|
443
|
+
response.checks.integrations
|
|
444
|
+
);
|
|
428
445
|
} catch (error) {
|
|
429
446
|
response.checks.integrations = {
|
|
430
447
|
status: 'unhealthy',
|
|
431
448
|
error: error.message,
|
|
432
449
|
};
|
|
433
450
|
response.status = 'unhealthy';
|
|
451
|
+
// eslint-disable-next-line no-console
|
|
452
|
+
console.log('Integrations check error:', error.message);
|
|
434
453
|
}
|
|
435
454
|
|
|
436
455
|
response.responseTime = response.calculateResponseTime();
|
|
@@ -438,6 +457,14 @@ router.get('/health/detailed', async (_req, res) => {
|
|
|
438
457
|
|
|
439
458
|
const statusCode = response.status === 'healthy' ? 200 : 503;
|
|
440
459
|
res.status(statusCode).json(response);
|
|
460
|
+
|
|
461
|
+
// eslint-disable-next-line no-console
|
|
462
|
+
console.log(
|
|
463
|
+
'Final health status:',
|
|
464
|
+
response.status,
|
|
465
|
+
'Response time:',
|
|
466
|
+
response.responseTime
|
|
467
|
+
);
|
|
441
468
|
});
|
|
442
469
|
|
|
443
470
|
router.get('/health/live', (_req, res) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/core",
|
|
3
3
|
"prettier": "@friggframework/prettier-config",
|
|
4
|
-
"version": "2.0.0--canary.419.
|
|
4
|
+
"version": "2.0.0--canary.419.29d9541.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@hapi/boom": "^10.0.1",
|
|
7
7
|
"aws-sdk": "^2.1200.0",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"uuid": "^9.0.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@friggframework/eslint-config": "2.0.0--canary.419.
|
|
26
|
-
"@friggframework/prettier-config": "2.0.0--canary.419.
|
|
27
|
-
"@friggframework/test": "2.0.0--canary.419.
|
|
25
|
+
"@friggframework/eslint-config": "2.0.0--canary.419.29d9541.0",
|
|
26
|
+
"@friggframework/prettier-config": "2.0.0--canary.419.29d9541.0",
|
|
27
|
+
"@friggframework/test": "2.0.0--canary.419.29d9541.0",
|
|
28
28
|
"@types/lodash": "4.17.15",
|
|
29
29
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
30
30
|
"chai": "^4.3.6",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "29d95417b566c13df23e8d211caff257e49742bf"
|
|
60
60
|
}
|