Skip to content

Commit 803157b

Browse files
committed
chore: enhance health check with environment variable validation and debugging output
1 parent 24c559b commit 803157b

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

.github/workflows/health-checks.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ jobs:
5757
- name: Build project
5858
run: yarn build
5959

60+
- name: Debug Environment Variables
61+
run: |
62+
echo "LIT_STATUS_BACKEND_URL is: $LIT_STATUS_BACKEND_URL"
63+
echo "LIT_STATUS_WRITE_KEY is set: $([ -n "$LIT_STATUS_WRITE_KEY" ] && echo "YES" || echo "NO")"
64+
env:
65+
LIT_STATUS_WRITE_KEY: ${{ secrets.LIT_STATUS_WRITE_KEY }}
66+
LIT_STATUS_BACKEND_URL: ${{ vars.LIT_STATUS_BACKEND_URL }}
67+
6068
- name: Run health check for datil-dev
6169
run: NETWORK=datil-dev yarn ci:health
6270
env:

local-tests/health/index.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,22 @@ const NETWORK = process.env.NETWORK!;
66
const PRODUCT = 'js-sdk/datil';
77

88
async function runHealthCheck() {
9+
console.log('🔍 Environment Variables:');
10+
console.log(' NETWORK:', process.env.NETWORK);
11+
console.log(' LIT_STATUS_BACKEND_URL:', process.env.LIT_STATUS_BACKEND_URL);
12+
console.log(' LIT_STATUS_WRITE_KEY:', process.env.LIT_STATUS_WRITE_KEY ? '[SET]' : '[NOT SET]');
13+
914
if (!NETWORK) {
1015
throw new Error('❌ NETWORK is not set');
1116
}
17+
18+
if (!process.env.LIT_STATUS_BACKEND_URL) {
19+
throw new Error('❌ LIT_STATUS_BACKEND_URL is not set');
20+
}
21+
22+
if (!process.env.LIT_STATUS_WRITE_KEY) {
23+
throw new Error('❌ LIT_STATUS_WRITE_KEY is not set');
24+
}
1225

1326
const statusClient = createLitStatusClient({
1427
url: process.env.LIT_STATUS_BACKEND_URL,
@@ -66,9 +79,10 @@ async function runHealthCheck() {
6679
(async () => {
6780
try {
6881
await runHealthCheck();
82+
console.log('✅ Health check completed successfully');
83+
process.exit(0);
6984
} catch (error) {
70-
console.error(error);
71-
} finally {
72-
process.exit();
85+
console.error('❌ Health check failed:', error);
86+
process.exit(1);
7387
}
7488
})();

0 commit comments

Comments
 (0)