Rook ceph listing Objects in a bucket with JS AWS SDK

Viewed 16

I have managed to PUT and GET objects into arook-cephbucket.

However, I when I'm trying to use the listObjectsV2 or listObjects functions to list the objects in a specific bucket It returns me an empty array for Contents and CommonPrefixes.

Code example:

const AWS = require('aws-sdk');
const s3Options = {
  accessKeyId: 'accessKeyId',
  secretAccessKey: 'secretAccessKey'
  endpoint: new AWS.Endpoint('endPoint'),
  sslEnabled: false,
  s3BucketEndpoint: true
};
const S3 = new AWS.S3(s3Options);
response = await S3.listObjectsV2( { Bucket: bucket }).promise();
console.log(response);

And the response is:

{ Contents: [], CommonPrefixes: [] }

with Python it is working ok, but not with the JS AWS SDK

Python working example:

import boto.s3.connection
def main():
    conn = boto.connect_s3(
        aws_access_key_id=access_key,
        aws_secret_access_key=secret_key,
        host=host,
        is_secure=ceph_has_secured_endpoint,
        calling_format=boto.s3.connection.OrdinaryCallingFormat(),
    )
    bucket = conn.get_bucket(bucket_name)

    for key in bucket.list():
        print("{name}\t{size}\t{modified}".format(
            name=key.name,
            size=key.size,
            modified=key.last_modified,
        ))


if __name__ == '__main__':
    main()
0 Answers
Related