Skip to content

Commit

Permalink
chore: add logger to finishUpload endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
apsantiso committed Jan 7, 2025
1 parent e5fc5bd commit 5db4c81
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 5db4c81

Please sign in to comment.