diff --git a/lib/api/objectDelete.js b/lib/api/objectDelete.js index b8ec7fb168..d2045821bd 100644 --- a/lib/api/objectDelete.js +++ b/lib/api/objectDelete.js @@ -51,13 +51,6 @@ function objectDeleteInternal(authInfo, request, log, isExpiration, cb) { const reqVersionId = decodedVidResult; const hasGovernanceBypass = hasGovernanceBypassHeader(request.headers); - // Reassign a specific apiMethod, as monitoring can rely on the - // type of cloudserver instance to determine it comes from Backbeat routes. - // This is also needed for quota evaluation, where "routeBackbeat" cannot - // be used for different operations, such as putObject - // eslint-disable-next-line no-param-reassign - request.apiMethod = reqVersionId ? 'objectDeleteVersion' : 'deleteObject'; - const valParams = { authInfo, bucketName, diff --git a/lib/routes/routeBackbeat.js b/lib/routes/routeBackbeat.js index e081c46e9b..c28c14fed0 100644 --- a/lib/routes/routeBackbeat.js +++ b/lib/routes/routeBackbeat.js @@ -711,6 +711,16 @@ function putObject(request, response, log, callback) { } function deleteObjectFromExpiration(request, response, userInfo, log, callback) { + // Reassign a specific apiMethod, as it is needed for quota evaluation (at least), where + // "routeBackbeat" cannot be used as it is used for all backbeat API operations... + // eslint-disable-next-line no-param-reassign + request.apiMethod = 'deleteObject'; + + // Also need to fix `apiMethods`, which is kind of hard-coded to `objectReplicate` for backbeat + // routes. + // eslint-disable-next-line no-param-reassign + request.apiMethods = ['objectDelete', 'objectDeleteVersion', ...request.apiMethods]; + return objectDeleteInternal(userInfo, request, log, true, err => { if (err) { log.error('error deleting object from expiration', {