Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: for debugging via dedicated transformer #3020

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/v0/destinations/marketo_bulk_upload/fileUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
requestTime = endTime - startTime;
stats.histogram('marketo_bulk_upload_create_file_time', requestTime);
stats.histogram('marketo_bulk_upload_upload_file_size', fileSize);
console.log(fileSize);

Check warning on line 146 in src/v0/destinations/marketo_bulk_upload/fileUpload.js

View workflow job for this annotation

GitHub Actions / Code Coverage

Unexpected console statement
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should done using logger with proper message including what is the destination id etc


return { readStream, successfulJobs, unsuccessfulJobs };
}
Expand Down Expand Up @@ -206,8 +207,8 @@
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);
Expand Down
2 changes: 1 addition & 1 deletion src/v0/destinations/marketo_bulk_upload/poll.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
);
}
Expand Down
24 changes: 18 additions & 6 deletions src/v0/destinations/marketo_bulk_upload/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
// 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),
Expand All @@ -172,7 +172,7 @@

// 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":"<dummy-access-token>","token_type":"bearer","expires_in":0,"scope":"[email protected]"}
wherein "expires_in":0 denotes that we should refresh the accessToken but its not expired yet.
Expand All @@ -185,7 +185,10 @@
}
return accessTokenResponse.response.access_token;
}
throw new AbortedError('Could not retrieve authorisation token', 400);
throw new AbortedError(

Check warning on line 188 in src/v0/destinations/marketo_bulk_upload/util.js

View check run for this annotation

Codecov / codecov/patch

src/v0/destinations/marketo_bulk_upload/util.js#L188

Added line #L188 was not covered by tests
`Could not retrieve authorisation token due to error ${accessTokenResponse}`,
400,
);
});

/**
Expand Down Expand Up @@ -254,14 +257,18 @@
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(

Check warning on line 267 in src/v0/destinations/marketo_bulk_upload/util.js

View check run for this annotation

Codecov / codecov/patch

src/v0/destinations/marketo_bulk_upload/util.js#L267

Added line #L267 was not covered by tests
`Failure during fetching job status due to error : ${marketoResponse}`,
500,
resp,
);
}

/*
Expand Down Expand Up @@ -336,6 +343,7 @@
resp.response?.result[0]?.importId
) {
const { importId } = resp.response.result[0];
console.log(importId);

Check warning on line 346 in src/v0/destinations/marketo_bulk_upload/util.js

View workflow job for this annotation

GitHub Actions / Code Coverage

Unexpected console statement
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should done using logger with proper message including what is the destination id etc

stats.histogram('marketo_bulk_upload_upload_file_time', requestTime);

stats.increment(UPLOAD_FILE, {
Expand Down Expand Up @@ -394,7 +402,11 @@
fieldMap[field?.name] = field?.dataType;
});
} else {
throw new RetryableError('Failed to fetch Marketo Field Schema', 500, fieldSchemaMapping);
throw new RetryableError(

Check warning on line 405 in src/v0/destinations/marketo_bulk_upload/util.js

View check run for this annotation

Codecov / codecov/patch

src/v0/destinations/marketo_bulk_upload/util.js#L405

Added line #L405 was not covered by tests
`Failed to fetch Marketo Field Schema due to error ${fieldSchemaMapping}`,
500,
fieldSchemaMapping,
);
}
return fieldMap;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
{
"statusCode": 400,
"error": "Unable to fetch job status"
"error": "Unable to fetch job status: due to error "
}
]
},
Expand All @@ -21,7 +21,7 @@
},
{
"statusCode": 400,
"error": "Unable to fetch job status"
"error": "Unable to fetch job status: due to error "
}
]
}
Expand Down
Loading