From 4580541ed96666f05e14258c55e023583b001b17 Mon Sep 17 00:00:00 2001 From: Yashasvi Bajpai <33063622+yashasvibajpai@users.noreply.github.com> Date: Fri, 3 Jan 2025 12:27:05 +0530 Subject: [PATCH 1/3] fix: add missing statuscode for poll call, update error string --- .../klaviyobulkupload/klaviyobulkupload.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/router/batchrouter/asyncdestinationmanager/klaviyobulkupload/klaviyobulkupload.go b/router/batchrouter/asyncdestinationmanager/klaviyobulkupload/klaviyobulkupload.go index aaff4819f0..5582ff5ced 100644 --- a/router/batchrouter/asyncdestinationmanager/klaviyobulkupload/klaviyobulkupload.go +++ b/router/batchrouter/asyncdestinationmanager/klaviyobulkupload/klaviyobulkupload.go @@ -119,9 +119,10 @@ func (kbu *KlaviyoBulkUploader) Poll(pollInput common.AsyncPoll) common.PollStat pollresp, err := kbu.KlaviyoAPIService.GetUploadStatus(importId) if err != nil { return common.PollStatusResponse{ - Complete: true, - HasFailed: true, - Error: err.Error(), + StatusCode: 400, + Complete: true, + HasFailed: true, + Error: `Error during fetching upload status `+ err.Error(), } } From 0fa6b601c94016371edb1913073da02699eab4bc Mon Sep 17 00:00:00 2001 From: Yashasvi Bajpai <33063622+yashasvibajpai@users.noreply.github.com> Date: Mon, 6 Jan 2025 11:16:54 +0530 Subject: [PATCH 2/3] chore: update default status code message for bad request --- router/batchrouter/handle_async.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/router/batchrouter/handle_async.go b/router/batchrouter/handle_async.go index c5dfdb89d7..b7f67dd959 100644 --- a/router/batchrouter/handle_async.go +++ b/router/batchrouter/handle_async.go @@ -271,7 +271,7 @@ func (brt *Handle) updatePollStatusToDB( } } } else if pollResp.StatusCode == http.StatusBadRequest { - statusList, _, jobIDConnectionDetailsMap = brt.prepareJobStatusList(importingList, jobsdb.JobStatusT{JobState: jobsdb.Aborted.State, ErrorResponse: misc.UpdateJSONWithNewKeyVal(routerutils.EmptyPayload, "error", "poll failed with status code 400")}, sourceID, destinationID) + statusList, _, jobIDConnectionDetailsMap = brt.prepareJobStatusList(importingList, jobsdb.JobStatusT{JobState: jobsdb.Aborted.State, ErrorResponse: misc.UpdateJSONWithNewKeyVal(routerutils.EmptyPayload, "error", pollResp.Error)}, sourceID, destinationID) if err := brt.updateJobStatuses(ctx, destinationID, importingList, importingList, statusList); err != nil { brt.logger.Errorf("[Batch Router] Failed to update job status for Dest Type %v with error %v", brt.destType, err) return statusList, err From 99ab6decb6e3a5e511741b56d0a220a2cd32948d Mon Sep 17 00:00:00 2001 From: Yashasvi Bajpai <33063622+yashasvibajpai@users.noreply.github.com> Date: Mon, 6 Jan 2025 11:53:36 +0530 Subject: [PATCH 3/3] chore: update to 5xx, add obscit log for visibility --- .../klaviyobulkupload/klaviyobulkupload.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/router/batchrouter/asyncdestinationmanager/klaviyobulkupload/klaviyobulkupload.go b/router/batchrouter/asyncdestinationmanager/klaviyobulkupload/klaviyobulkupload.go index 5582ff5ced..015e2cb025 100644 --- a/router/batchrouter/asyncdestinationmanager/klaviyobulkupload/klaviyobulkupload.go +++ b/router/batchrouter/asyncdestinationmanager/klaviyobulkupload/klaviyobulkupload.go @@ -17,6 +17,7 @@ import ( backendconfig "github.com/rudderlabs/rudder-server/backend-config" "github.com/rudderlabs/rudder-server/jobsdb" "github.com/rudderlabs/rudder-server/router/batchrouter/asyncdestinationmanager/common" + obskit "github.com/rudderlabs/rudder-observability-kit/go/labels" ) const ( @@ -118,11 +119,12 @@ func (kbu *KlaviyoBulkUploader) Poll(pollInput common.AsyncPoll) common.PollStat allComplete = false pollresp, err := kbu.KlaviyoAPIService.GetUploadStatus(importId) if err != nil { + kbu.Logger.Errorn("Error during fetching Klaviyo Bulk Upload status", obskit.Error(err)) return common.PollStatusResponse{ - StatusCode: 400, + StatusCode: 500, Complete: true, HasFailed: true, - Error: `Error during fetching upload status `+ err.Error(), + Error: `Error during fetching upload status ` + err.Error(), } }