Skip to content

Commit

Permalink
Merge pull request #164 from internxt/chore/add-logger-with-client-to…
Browse files Browse the repository at this point in the history
…-finish-upload

[_] chore: add logger to finishUpload endpoint
  • Loading branch information
sg-gs authored Jan 7, 2025
2 parents e5fc5bd + 5db4c81 commit 9c97691
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/server/routes/buckets.js
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,7 @@ BucketsRouter.prototype.startUpload = async function (req, res, next) {
// eslint-disable-next-line complexity
BucketsRouter.prototype.finishUpload = async function (req, res, next) {
const bucketId = req.params.id;
const driveClient = req.headers['internxt-client'];

if (!req.body.index || !req.body.shards) {
return next(new errors.BadRequestError('Missing parameters'));
Expand Down Expand Up @@ -1270,6 +1271,16 @@ BucketsRouter.prototype.finishUpload = async function (req, res, next) {
return next(new errors.TransferRateError(err.message));
}

const errorDetails = {
client: driveClient,
body: req.body,
headers: req.headers,
errorMessage: err.message,
errorStack: err.stack,
};

log.error('finishUpload: Error for bucket %s: for user: %s, details: %s', bucketId, req.user.uuid, JSON.stringify(errorDetails));

return next(new errors.InternalError(err.message));
}
};
Expand Down

0 comments on commit 9c97691

Please sign in to comment.