IBM / ibm-cos-sdk-js

ibm-cos-sdk-js
Apache License 2.0
38 stars 19 forks source link

List Object is not working..! #14

Closed mdumanoj closed 6 years ago

mdumanoj commented 6 years ago

I used the following code to list the Buckets and I'm getting Bucket Name in the Response Data.

   cos.listBuckets((err,data) => {
        logger.info("Data : " + data.Buckets[0].Name);
        logger.info("Err : " + JSON.stringify(err));
    })

I am using the same bucket name from the Response data to List the Objects within the buckets with following code.

   cos.listObjects({
        Bucket : <BucketName>
    },(err,data) => {
        logger.info("Data : " + data);
        logger.info("Err : " + JSON.stringify(err));
    })

I am getting Error Response as message : "The specified bucket does not exist." ,code : "NoSuchBucket"

Any fix for this?

widget- commented 6 years ago

You may be trying to access your bucket in the wrong region. listBuckets lists the buckets across all regions. There should be a locationConstraint listed with each bucket indicating which region it belongs to.

mdumanoj commented 6 years ago

Yeah. I didn't noticed the region. Thank you @widget-