From d2f94b8235c629e79b924cfc97f6c41811cdae80 Mon Sep 17 00:00:00 2001 From: Max Cao Date: Wed, 31 Jul 2024 16:27:41 -0700 Subject: [PATCH] fix: reassign err to prevent invalid return in KedaProvider `GetExternalMetric` (#6010) Signed-off-by: Max Cao --- CHANGELOG.md | 1 + pkg/provider/provider.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39a1dca9031..b101296a375 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -89,6 +89,7 @@ Here is an overview of all new **experimental** features: ### Fixes - **General**: Check for missing CRD references and sample CRs ([#5920](https://github.com/kedacore/keda/issues/5920)) +- **General**: Fix panic in `KedaProvider` when getting metrics from Metrics Service if the gRPC Server connection is not established ([#6009](https://github.com/kedacore/keda/issues/6009)) - **General**: Scalers are properly closed after being refreshed ([#5806](https://github.com/kedacore/keda/issues/5806)) - **New Relic Scaler**: Fix CVE-2024-6104 in github.com/hashicorp/go-retryablehttp ([#5944](https://github.com/kedacore/keda/issues/5944)) diff --git a/pkg/provider/provider.go b/pkg/provider/provider.go index 5a32360fc8d..d5c5e3c6593 100644 --- a/pkg/provider/provider.go +++ b/pkg/provider/provider.go @@ -86,7 +86,8 @@ func (p *KedaProvider) GetExternalMetric(ctx context.Context, namespace string, // Get Metrics from Metrics Service gRPC Server if !p.grpcClient.WaitForConnectionReady(ctx, logger) { grpcClientConnected = false - logger.Error(fmt.Errorf("timeout while waiting to establish gRPC connection to KEDA Metrics Service server"), "timeout", "server", p.grpcClient.GetServerURL()) + err := fmt.Errorf("timeout while waiting to establish gRPC connection to KEDA Metrics Service server") + logger.Error(err, "timeout", "server", p.grpcClient.GetServerURL()) return nil, err } if !grpcClientConnected {