missing backups: check if the s3 end point is valid
s3 api never return NotFound or ENOENT - https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html Sadly, DO/OVH etc just return NotFound instead of NoSuchKey. And we cannot distinguish easily if we are talking to some s3 server or some random server. This is applicable for things like say minio where maybe there is something apache now just giving out 404 / NotFound.
This commit is contained in:
@@ -155,6 +155,7 @@ function exists(apiConfig, backupFilePath, callback) {
|
||||
};
|
||||
|
||||
s3.headObject(params, function (error) {
|
||||
if (!Object.keys(this.httpResponse.headers).some(h => h.startsWith('x-amz'))) return callback(new BoxError(BoxError.EXTERNAL_ERROR, 'not a s3 endpoint'));
|
||||
if (error && S3_NOT_FOUND(error)) return callback(null, false);
|
||||
if (error) return callback(new BoxError(BoxError.EXTERNAL_ERROR, error.message || error.code));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user