DeleteObjectCommand returns 204, but Object still exists

Hello :slight_smile:

I’m currently writing a simple wordpress backup, which does the following:

  • get’s triggered by cron
  • creates a tar.gz of all my wordpress files
  • uploads the file
  • if upload success:
    • delete local files
    • get all existing backups
    • if existing.length > 5: delete oldest backup
  • else write log and error.

My problem is simply, that I send a DeleteObjectCommand with the key for the oldest backup, and the correct bucket ( same one which was used for uploading earlier) and get an 204 message back, which should be a success message.

But in the next run, the listed ‘existing backup’ still contains the same old backup from the previous run and my count went just one up.

No errors. Just looks like a successful deletion, but the file is still there.

I would be happy for any pointers in the correcy direction.

I’ll try to show some logs: (with some cut parts)

The previous run ( a few less logs)

CREATE LOCAL BACKUP
tar -cf lektorat-wordpress/2024-1-6-17-21.tar.gz
UPLOAD BACKUP
sucess  {
  '$metadata': {
    httpStatusCode: 200,
    requestId: '',
    extendedRequestId: undefined,
    cfId: undefined,
    attempts: 1,
    totalRetryDelay: 0
  },
  ETag: '""'
}
Upload of  lektorat-wordpress/2024-1-6-17-21.tar.gz  successful, deleting local files
GET BACKUPS
lektorat-wordpress/2024-0-31-8-50.tar.gz
lektorat-wordpress/2024-1-6-17-17.tar.gz
lektorat-wordpress/2024-1-6-17-21.tar.gz
lektorat-wordpress/2024-1-6-17-5.tar.gz
lektorat-wordpress/2024-1-6-17-8.tar.gz
lektorat-wordpress/2024-1-6-7-10.tar.gz
lektorat-wordpress/2024-1-6-8-11.tar.gz
lektorat-wordpress/2024-1-6-8-15.tar.gz
OLDEST BACKUP {
  Key: 'lektorat-wordpress/2024-0-31-8-50.tar.gz',
  LastModified: 2024-01-31T07:50:13.573Z,
  ETag: '""',
  Size: 520335360,
  StorageClass: 'STANDARD',
  Owner: {
    DisplayName: 'storj',
    ID: ''
  }
}
deleted  lektorat-wordpress/2024-0-31-8-50.tar.gz
DELETED OLDEST BACKUP

My latest run

CREATE LOCAL BACKUP
tar -cf lektorat-wordpress/2024-1-6-17-23.tar.gz lektorat-wordpress/db.sql lektorat-wordpress/wordpress.tar.gz
UPLOAD BACKUP
sucess  {
  '$metadata': {
    httpStatusCode: 200,
    requestId: '',
    extendedRequestId: undefined,
    cfId: undefined,
    attempts: 1,
    totalRetryDelay: 0
  },
}
Upload of  lektorat-wordpress/2024-1-6-17-23.tar.gz  successful, deleting local files
GET BACKUPS
lektorat-wordpress/2024-0-31-8-50.tar.gz
lektorat-wordpress/2024-1-6-17-17.tar.gz
lektorat-wordpress/2024-1-6-17-21.tar.gz
lektorat-wordpress/2024-1-6-17-23.tar.gz
lektorat-wordpress/2024-1-6-17-5.tar.gz
lektorat-wordpress/2024-1-6-17-8.tar.gz
lektorat-wordpress/2024-1-6-7-10.tar.gz
lektorat-wordpress/2024-1-6-8-11.tar.gz
lektorat-wordpress/2024-1-6-8-15.tar.gz
OLDEST BACKUP {
  Key: 'lektorat-wordpress/2024-0-31-8-50.tar.gz',
  LastModified: 2024-01-31T07:50:13.573Z,
  Size: 520335360,
  StorageClass: 'STANDARD',
  Owner: {
    DisplayName: 'storj',
    ID: ''
  }
}
// delete response
{
  '$metadata': {
    httpStatusCode: 204,
    requestId: '17B13870ED49DF88',
    extendedRequestId: undefined,
    cfId: undefined,
    attempts: 1,
    totalRetryDelay: 0
  }
}
deleted  lektorat-wordpress/2024-0-31-8-50.tar.gz
DELETED OLDEST BACKUP

If you delete a not existing file (mistake in the given path) it will also return success. That sounds like the possible mistake here. Just some kind of typo in the path.

2 Likes