Skip to content

Commit 16451f5

Browse files
committed
fix: Add try catch for getting local credentials
1 parent c533126 commit 16451f5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

backend/companion/getKcpToken.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,10 @@ export async function getKcpToken() {
4747

4848
function getLocalCredentials() {
4949
const fs = require('fs');
50-
return JSON.parse(fs.readFileSync('companion/credentials.json', 'utf8'));
50+
try {
51+
return JSON.parse(fs.readFileSync('companion/credentials.json', 'utf8'));
52+
} catch (error) {
53+
console.warn('Local credentials file not found or could not be read');
54+
return null;
55+
}
5156
}

0 commit comments

Comments
 (0)