diff --git a/pkg/storage/chunk/client/aws/s3_storage_client.go b/pkg/storage/chunk/client/aws/s3_storage_client.go index a6d9501616f11..b4a63216d8628 100644 --- a/pkg/storage/chunk/client/aws/s3_storage_client.go +++ b/pkg/storage/chunk/client/aws/s3_storage_client.go @@ -325,6 +325,12 @@ func (a *S3ObjectClient) ObjectExists(ctx context.Context, objectKey string) (bo if lastErr == nil { return true, nil } + // AWS SDK v1 doesn't properly support error unwrapping, so we have to check the error message + // https://github.com/aws/aws-sdk-go/issues/2820#issuecomment-822767966 + if strings.Contains(lastErr.Error(), "NoSuchKey") { + return false, lastErr + } + retries.Wait() }