diff --git a/src/v0/destinations/marketo_bulk_upload/fileUpload.js b/src/v0/destinations/marketo_bulk_upload/fileUpload.js index c7212ff9cb..10f86ef390 100644 --- a/src/v0/destinations/marketo_bulk_upload/fileUpload.js +++ b/src/v0/destinations/marketo_bulk_upload/fileUpload.js @@ -143,6 +143,7 @@ const getFileData = async (inputEvents, config, headerArr) => { requestTime = endTime - startTime; stats.histogram('marketo_bulk_upload_create_file_time', requestTime); stats.histogram('marketo_bulk_upload_upload_file_size', fileSize); + console.log(fileSize); return { readStream, successfulJobs, unsuccessfulJobs }; } @@ -206,8 +207,8 @@ const getImportID = async (input, config, accessToken, csvHeader) => { stats.counter('marketo_bulk_upload_upload_file_unsuccJobs', unsuccessfulJobs.length); if (!isHttpStatusSuccess(resp.status)) { throw new NetworkError( - 'Unable to upload file', - hydrateStatusForServer(resp.status, 'During fetching poll status'), + `Unable to upload file due to error : ${resp.response}`, + hydrateStatusForServer(resp.status, 'During uploading file'), ); } return handleFileUploadResponse(resp, successfulJobs, unsuccessfulJobs, requestTime, config); diff --git a/src/v0/destinations/marketo_bulk_upload/poll.js b/src/v0/destinations/marketo_bulk_upload/poll.js index 3ad458c545..97211c4763 100644 --- a/src/v0/destinations/marketo_bulk_upload/poll.js +++ b/src/v0/destinations/marketo_bulk_upload/poll.js @@ -34,7 +34,7 @@ const getPollStatus = async (event) => { state: 'Retryable', }); throw new NetworkError( - 'Could not poll status', + `Could not poll status: due to error ${pollStatus.response}`, hydrateStatusForServer(pollStatus.status, 'During fetching poll status'), ); } diff --git a/src/v0/destinations/marketo_bulk_upload/util.js b/src/v0/destinations/marketo_bulk_upload/util.js index 7b329a3441..98363402ed 100644 --- a/src/v0/destinations/marketo_bulk_upload/util.js +++ b/src/v0/destinations/marketo_bulk_upload/util.js @@ -153,7 +153,7 @@ const getAccessToken = async (config) => // sample response : {response: '[ENOTFOUND] :: DNS lookup failed', status: 400} if (!isHttpStatusSuccess(accessTokenResponse.status)) { throw new NetworkError( - 'Could not retrieve authorisation token', + `Could not retrieve authorisation token due to error ${accessTokenResponse}`, hydrateStatusForServer(accessTokenResponse.status, FETCH_ACCESS_TOKEN), { [tags.TAG_NAMES.ERROR_TYPE]: getDynamicErrorType(accessTokenResponse.status), @@ -172,7 +172,7 @@ const getAccessToken = async (config) => // when access token is present if (accessTokenResponse.response.access_token) { - /* This scenario will handle the case when we get the foloowing response + /* This scenario will handle the case when we get the following response status: 200 respnse: {"access_token":"","token_type":"bearer","expires_in":0,"scope":"dummy@scope.com"} wherein "expires_in":0 denotes that we should refresh the accessToken but its not expired yet. @@ -185,7 +185,10 @@ const getAccessToken = async (config) => } return accessTokenResponse.response.access_token; } - throw new AbortedError('Could not retrieve authorisation token', 400); + throw new AbortedError( + `Could not retrieve authorisation token due to error ${accessTokenResponse}`, + 400, + ); }); /** @@ -254,14 +257,18 @@ const handleFetchJobStatusResponse = (resp, type) => { if (!isHttpStatusSuccess(marketoReposnseStatus)) { logger.info('[Network Error]:Failed during fetching job status', { marketoResponse, type }); throw new NetworkError( - 'Unable to fetch job status', + `Unable to fetch job status: due to error ${marketoResponse}`, hydrateStatusForServer(marketoReposnseStatus, 'During fetching job status'), ); } if (marketoResponse?.success === false) { logger.info('[Application Error]Failed during fetching job status', { marketoResponse, type }); - throw new RetryableError('Failure during fetching job status', 500, resp); + throw new RetryableError( + `Failure during fetching job status due to error : ${marketoResponse}`, + 500, + resp, + ); } /* @@ -336,6 +343,7 @@ const handleFileUploadResponse = (resp, successfulJobs, unsuccessfulJobs, reques resp.response?.result[0]?.importId ) { const { importId } = resp.response.result[0]; + console.log(importId); stats.histogram('marketo_bulk_upload_upload_file_time', requestTime); stats.increment(UPLOAD_FILE, { @@ -394,7 +402,11 @@ const getFieldSchemaMap = async (accessToken, munchkinId) => { fieldMap[field?.name] = field?.dataType; }); } else { - throw new RetryableError('Failed to fetch Marketo Field Schema', 500, fieldSchemaMapping); + throw new RetryableError( + `Failed to fetch Marketo Field Schema due to error ${fieldSchemaMapping}`, + 500, + fieldSchemaMapping, + ); } return fieldMap; }; diff --git a/test/__tests__/data/marketo_bulk_upload_jobStatus_output.json b/test/__tests__/data/marketo_bulk_upload_jobStatus_output.json index eac43ee82c..320ed050c5 100644 --- a/test/__tests__/data/marketo_bulk_upload_jobStatus_output.json +++ b/test/__tests__/data/marketo_bulk_upload_jobStatus_output.json @@ -8,7 +8,7 @@ }, { "statusCode": 400, - "error": "Unable to fetch job status" + "error": "Unable to fetch job status: due to error " } ] }, @@ -21,7 +21,7 @@ }, { "statusCode": 400, - "error": "Unable to fetch job status" + "error": "Unable to fetch job status: due to error " } ] }