我有下面我localstack
在我的机器上使用的代码。当我列出存储桶时它会起作用。但是当我做listObjects时它返回空数组。
import * as AWS from "aws-sdk";
let s3 = new AWS.S3({endpoint: 'http://localhost:4572', region: 'us-east-1'});
(async () => {
// list buckets works, returns all my local buckets
let buckets = await s3.listBuckets().promise()
console.log('buckets: ', buckets)
// this returns empty array
let listOfobjects = await s3.listObjects({Bucket: 'store-us-east-1'}).promise()
console.log('listOfobjects: ', listOfobjects);
})()
# ls works via command line, return Invoice.pdf
aws --endpoint-url=http://localhost:4572 s3 ls s3://store-us-east-1
2020-01-15 18:02:55 82032 Invoice.pdf
任何帮助将不胜感激。