Skip to content

Commit 4f22813

Browse files
authored
fallback if get remote info fails to cluster health call (#886) (#896)
Signed-off-by: Amit Galitzky <amgalitz@amazon.com>
1 parent 86adb4f commit 4f22813

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

server/routes/opensearch.ts

+13-8
Original file line numberDiff line numberDiff line change
@@ -570,14 +570,19 @@ export default class OpenSearchService {
570570

571571
let clustersResponse: ClusterInfo[] = [];
572572

573-
const remoteInfo = await callWithRequest('transport.request', {
574-
method: 'GET',
575-
path: '/_remote/info',
576-
});
577-
clustersResponse = Object.keys(remoteInfo).map((key) => ({
578-
name: key,
579-
localCluster: false,
580-
}));
573+
try {
574+
const remoteInfo = await callWithRequest('transport.request', {
575+
method: 'GET',
576+
path: '/_remote/info',
577+
});
578+
clustersResponse = Object.keys(remoteInfo).map((key) => ({
579+
name: key,
580+
localCluster: false,
581+
}));
582+
} catch (remoteErr) {
583+
console.warn('Failed to fetch remote cluster info, proceeding with local datasource info only.', remoteErr);
584+
}
585+
581586

582587
const clusterHealth = await callWithRequest('cat.health', {
583588
format: 'json',

0 commit comments

Comments
 (0)