From 802ebc11ac0dec6f4cb08c6cc45e32eca2126a93 Mon Sep 17 00:00:00 2001 From: mukul-tyagi08 Date: Tue, 10 Dec 2024 11:59:42 +0530 Subject: [PATCH] fix: empty endpoint group check --- .../health-check/api-proxy-health-check.component.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gravitee-apim-console-webui/src/management/api/proxy/health-check/api-proxy-health-check.component.ts b/gravitee-apim-console-webui/src/management/api/proxy/health-check/api-proxy-health-check.component.ts index ec35b9d5cc6..82dc64e1f83 100644 --- a/gravitee-apim-console-webui/src/management/api/proxy/health-check/api-proxy-health-check.component.ts +++ b/gravitee-apim-console-webui/src/management/api/proxy/health-check/api-proxy-health-check.component.ts @@ -75,7 +75,12 @@ export class ApiProxyHealthCheckComponent implements OnInit, OnDestroy { onlyApiV2Filter(this.snackBarService), switchMap((api) => { const apiHealthCheck = ApiProxyHealthCheckFormComponent.HealthCheckFromFormGroup(this.healthCheckForm, false); - this.updateEndpointsHealthCheckConfig(api.proxy?.groups); + try { + this.updateEndpointsHealthCheckConfig(api.proxy?.groups); + } catch (error) { + this.snackBarService.error('Failed to update configuration. Please ensure endpoint groups are properly defined.'); + return EMPTY; + } return this.apiService.update(api.id, { ...api, @@ -102,7 +107,7 @@ export class ApiProxyHealthCheckComponent implements OnInit, OnDestroy { updateEndpointsHealthCheckConfig(groups: Proxy['groups']) { groups.forEach((group) => { - group.endpoints.forEach((endpoint) => { + group.endpoints?.forEach((endpoint) => { // If healthcheck is disabled, set inherit to false if ( (endpoint.healthCheck?.inherit === undefined || endpoint.healthCheck?.inherit === true) &&