From d49708d0d46c906a483bf124924b9e798b0f7dcc Mon Sep 17 00:00:00 2001 From: Khurram Baig Date: Mon, 4 Nov 2024 10:30:39 +0530 Subject: [PATCH] Fix Panic in the API server API server gets panic under certain negative scenarios. We fixed that by creating a new variable for error. --- pkg/api/server/v1alpha2/plugin_logs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/api/server/v1alpha2/plugin_logs.go b/pkg/api/server/v1alpha2/plugin_logs.go index ceb416de8..56a6a9677 100644 --- a/pkg/api/server/v1alpha2/plugin_logs.go +++ b/pkg/api/server/v1alpha2/plugin_logs.go @@ -169,8 +169,8 @@ func (s *LogPluginServer) getLokiLogs(writer *logs.BufferedLog, parent string, r req.Header.Set("Authorization", "Bearer "+token.AccessToken) resp, err := s.client.Do(req) if err != nil { - dump, err := httputil.DumpRequest(req, true) - if err == nil { + dump, derr := httputil.DumpRequest(req, true) + if derr == nil { s.logger.Debugf("Request Dump***:\n %q\n", dump) } s.logger.Errorf("request to loki failed, err: %s, req: %v", err.Error(), req)