Skip to content

Commit 2056990

Browse files
committed
improve cloud resolver error for troubleshooting
1 parent 38a1f88 commit 2056990

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

packages/unraid-api-plugin-connect/src/resolver/cloud.resolver.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ export class CloudResolver {
2727
const minigraphql = this.cloudService.checkMothershipClient();
2828
const cloud = await this.cloudService.checkCloudConnection();
2929

30+
const cloudError = cloud.error ? `NETWORK: ${cloud.error}` : '';
31+
const miniGraphError = minigraphql.error ? `CLOUD: ${minigraphql.error}` : '';
32+
33+
let error = cloudError || miniGraphError || undefined;
34+
if (cloudError && miniGraphError) {
35+
error = `${cloudError}\n${miniGraphError}`;
36+
}
37+
3038
return {
3139
relay: {
3240
// Left in for UPC backwards compat.
@@ -38,10 +46,7 @@ export class CloudResolver {
3846
minigraphql,
3947
cloud,
4048
allowedOrigins: this.networkService.getAllowedOrigins(),
41-
error:
42-
`${
43-
cloud.error ? `NETWORK: ${cloud.error}` : ''
44-
}\n${minigraphql.error ? `CLOUD: ${minigraphql.error}` : ''}` || undefined,
49+
error,
4550
};
4651
}
4752
}

packages/unraid-api-plugin-connect/src/service/cloud.service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,11 @@ export class CloudService {
166166
try {
167167
ip = await this.checkDns();
168168
} catch (error) {
169-
this.logger.warn('Failed to fetch DNS, but Minigraph is connected - continuing');
169+
this.logger.warn(
170+
'Failed to fetch DNS, but Minigraph is connected - continuing. Error type: %s',
171+
typeof error
172+
);
173+
this.logger.error(error);
170174
ip = `ERROR: ${error instanceof Error ? error.message : 'Unknown Error'}`;
171175
// Clear error since we're actually connected to the cloud.
172176
// Do not populate the ip cache since we're in a weird state (this is a change from the previous behavior).

0 commit comments

Comments
 (0)