Open victimsss opened 1 year ago
@victimsss
by default the client does not have a timeout.
you could try setting minioClient.setRequestOptions({timeout:500})
if this is set, you would get error for client initilaization.
e.g:
connect ETIMEDOUT 12.84.9.111:22000
then for removeObject with invalid bucket, it will throw error.
mc.removeObject("test", "test", (e, res) => {
console.log(e.message, res)
})
//e.g invalid bucket.
The specified bucket does not exist
if invalid/non-existent object is passed, it would always return 204 or 200 OK
So it is working as expected.
@victimsss
by default the client does not have a timeout. you could try setting
minioClient.setRequestOptions({timeout:500})
if this is set, you would get error for client initilaization. e.g:connect ETIMEDOUT 12.84.9.111:22000
then for removeObject with invalid bucket, it will throw error.
mc.removeObject("test", "test", (e, res) => { console.log(e.message, res) })
//e.g invalid bucket. The specified bucket does not exist
if invalid/non-existent object is passed, it would always return 204 or 200 OK
So it is working as expected.
removeObjects, not removeObject.
with removeObjects
the errors if any are returned for each individual objects. as part of res
and not as part of e
. so the please take a look.
const deleteList = [
{ name: 'non-existent' },
{ name: '0.txt' },
{ name: 'does not exist object2' },
{ name: '1.txt' },
{ name: '2.txt' },
{ name: 'does not exist object1110' }
]
mc.removeObjects("test-bucket", deleteList ,(e, res) => {
if (e) {
return console.log(e)
}
console.log("Success", res)
// Note : Inspect the res to find out if an object deletion is success or failure.
})
e.g:
[
{
Code: 'AccessDenied',
Message: 'Access Denied.',
Key: 'non-existent',
VersionId: ''
},
{
Code: 'AccessDenied',
Message: 'Access Denied.',
Key: '0.txt',
VersionId: ''
},
{
Code: 'AccessDenied',
Message: 'Access Denied.',
Key: 'does not exist object2',
VersionId: ''
},
{
Code: 'AccessDenied',
Message: 'Access Denied.',
Key: '1.txt',
VersionId: ''
},
{
Code: 'AccessDenied',
Message: 'Access Denied.',
Key: '2.txt',
VersionId: ''
},
{
Code: 'AccessDenied',
Message: 'Access Denied.',
Key: 'does not exist object1110',
VersionId: ''
}
]
When the minio client is invalid, such as endPoint or port error, or even the minio service is not running, calling this API will not throw an error. I haven't checked other APIs for the time being. I hope the bug can be fixed in time.
When the minio client is invalid, such as endPoint or port error, or even the minio service is not running, calling this API will not throw an error. I haven't checked other APIs for the time being. I hope the bug can be fixed in time.
expect:connect ETIMEDOUT 12.84.9.111:22000
actual: Removed the objects successfully
I think you should try stopping the minio service and running the test case again
We will check and send a fix for this scenario
minio.js Line 1207 needs a fix like:
(e) => {
if (e) {
return cb(e, null)
}
return cb(null, _.flatten(batchResults))
},
version:7.1.1
When the minio client is invalid, such as endPoint or port error, or even the minio service is not running, calling this API will not throw an error. I haven't checked other APIs for the time being. I hope the bug can be fixed in time.
case: `var Minio = require('minio')
var minioClient = new Minio.Client({ endPoint: '192.168.128.109', // Any invalid IP port: 9000, useSSL: true, accessKey: 'Q3AM3UQ867SPQQA43P2F', secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG' }) minioClient.removeObjects(bucket, target, (e) => { if (e) { return console.log('Unable to remove Objects ', e) } console.log('Removed the objects successfully') })`