@friggframework/core 2.0.0--canary.419.a9bb30f.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 -14
- package/package.json +5 -5
|
@@ -15,20 +15,7 @@ const validateApiKey = (req, res, next) => {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
if (!apiKey || apiKey !== process.env.HEALTH_API_KEY) {
|
|
18
|
-
|
|
19
|
-
console.log('Incoming API Key Debug:', {
|
|
20
|
-
first3: apiKey ? apiKey.substring(0, 3) : 'undefined',
|
|
21
|
-
last3: apiKey ? apiKey.substring(apiKey.length - 3) : 'undefined',
|
|
22
|
-
length: apiKey ? apiKey.length : 0,
|
|
23
|
-
});
|
|
24
|
-
console.log('Health API Key Debug:', {
|
|
25
|
-
first3: healthApiKey ? healthApiKey.substring(0, 3) : 'undefined',
|
|
26
|
-
last3: healthApiKey
|
|
27
|
-
? healthApiKey.substring(healthApiKey.length - 3)
|
|
28
|
-
: 'undefined',
|
|
29
|
-
length: healthApiKey ? healthApiKey.length : 0,
|
|
30
|
-
});
|
|
31
|
-
console.log('Unauthorized access attempt to health endpoint');
|
|
18
|
+
console.error('Unauthorized access attempt to health endpoint');
|
|
32
19
|
return res.status(401).json({
|
|
33
20
|
status: 'error',
|
|
34
21
|
message: 'Unauthorized',
|
|
@@ -400,6 +387,8 @@ router.get('/health', async (_req, res) => {
|
|
|
400
387
|
});
|
|
401
388
|
|
|
402
389
|
router.get('/health/detailed', async (_req, res) => {
|
|
390
|
+
// eslint-disable-next-line no-console
|
|
391
|
+
console.log('Starting detailed health check');
|
|
403
392
|
const startTime = Date.now();
|
|
404
393
|
const response = buildHealthCheckResponse(startTime);
|
|
405
394
|
|
|
@@ -409,12 +398,16 @@ router.get('/health/detailed', async (_req, res) => {
|
|
|
409
398
|
if (!dbState.isConnected) {
|
|
410
399
|
response.status = 'unhealthy';
|
|
411
400
|
}
|
|
401
|
+
// eslint-disable-next-line no-console
|
|
402
|
+
console.log('Database check completed:', response.checks.database);
|
|
412
403
|
} catch (error) {
|
|
413
404
|
response.checks.database = {
|
|
414
405
|
status: 'unhealthy',
|
|
415
406
|
error: error.message,
|
|
416
407
|
};
|
|
417
408
|
response.status = 'unhealthy';
|
|
409
|
+
// eslint-disable-next-line no-console
|
|
410
|
+
console.log('Database check error:', error.message);
|
|
418
411
|
}
|
|
419
412
|
|
|
420
413
|
try {
|
|
@@ -422,12 +415,16 @@ router.get('/health/detailed', async (_req, res) => {
|
|
|
422
415
|
if (response.checks.encryption.status === 'unhealthy') {
|
|
423
416
|
response.status = 'unhealthy';
|
|
424
417
|
}
|
|
418
|
+
// eslint-disable-next-line no-console
|
|
419
|
+
console.log('Encryption check completed:', response.checks.encryption);
|
|
425
420
|
} catch (error) {
|
|
426
421
|
response.checks.encryption = {
|
|
427
422
|
status: 'unhealthy',
|
|
428
423
|
error: error.message,
|
|
429
424
|
};
|
|
430
425
|
response.status = 'unhealthy';
|
|
426
|
+
// eslint-disable-next-line no-console
|
|
427
|
+
console.log('Encryption check error:', error.message);
|
|
431
428
|
}
|
|
432
429
|
|
|
433
430
|
const { apiStatuses, allReachable } = await checkExternalAPIs();
|
|
@@ -435,15 +432,24 @@ router.get('/health/detailed', async (_req, res) => {
|
|
|
435
432
|
if (!allReachable) {
|
|
436
433
|
response.status = 'unhealthy';
|
|
437
434
|
}
|
|
435
|
+
// eslint-disable-next-line no-console
|
|
436
|
+
console.log('External APIs check completed:', response.checks.externalApis);
|
|
438
437
|
|
|
439
438
|
try {
|
|
440
439
|
response.checks.integrations = checkIntegrations();
|
|
440
|
+
// eslint-disable-next-line no-console
|
|
441
|
+
console.log(
|
|
442
|
+
'Integrations check completed:',
|
|
443
|
+
response.checks.integrations
|
|
444
|
+
);
|
|
441
445
|
} catch (error) {
|
|
442
446
|
response.checks.integrations = {
|
|
443
447
|
status: 'unhealthy',
|
|
444
448
|
error: error.message,
|
|
445
449
|
};
|
|
446
450
|
response.status = 'unhealthy';
|
|
451
|
+
// eslint-disable-next-line no-console
|
|
452
|
+
console.log('Integrations check error:', error.message);
|
|
447
453
|
}
|
|
448
454
|
|
|
449
455
|
response.responseTime = response.calculateResponseTime();
|
|
@@ -451,6 +457,14 @@ router.get('/health/detailed', async (_req, res) => {
|
|
|
451
457
|
|
|
452
458
|
const statusCode = response.status === 'healthy' ? 200 : 503;
|
|
453
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
|
+
);
|
|
454
468
|
});
|
|
455
469
|
|
|
456
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
|
}
|