NodeJS AWS SDK The specified bucket does not exist (also weird `aws s3 ls` behavior)
See original GitHub issueServer is running via docker like:
docker run -e initialBuckets=bucket-1,bucket-2 -e root=/tmp/buckets -p 9090:9090 -p 9191:9191 -v /tmp/buckets:/tmp/buckets -t adobe/s3mock
(Version running is 2.1.18
, which is latest as of this writing)
Im able to:
- Upload a Dockerfile
- Confirm I can download it again
- Confirm I can see the item listed with
list-objects-v2
aws --endpoint-url http://localhost:9090 s3 cp Dockerfile s3://bucket-1/Dockerfile
aws --endpoint-url http://localhost:9090 s3 cp s3://bucket-1/Dockerfile ./s
aws --endpoint-url http://localhost:9090 s3api list-objects-v2 --bucket bucket-1
Heres where the bugs start:
-
aws --endpoint-url http://localhost:9090 s3 ls bucket-1
isnt showing anything other than: -
NodeJS
aws-sdk
’sAWS.S3.putObject
is always throwing “NoSuchBucket: The specified bucket does not exist” (with the server printing “Responding with status 404: The specified bucket does not exist.”) -
AWS.S3.listObjectsV2
isnt listing anything
My NodeJS S3 is configured like:
new aws.S3({
accessKeyId: globals.AWS_ACCESS_KEY,
secretAccessKey: globals.AWS_SECRET_KEY,
endpoint: 'http://localhost:9090'
})
where the access and secret keys are just empty strings right now
My listObjectsV2 is:
const opts = {Bucket: 'bucket-1'}
const response = await s3.listObjectsV2(opts).promise()
My putObject is:
const obj = {
Bucket: 'bucket-1',
Body: 'some string',
Key: 'some-key'
}
await s3.putObject(obj).promise()
Let me know if I can provide any more info. Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:7 (3 by maintainers)
Top Results From Across the Web
AWS s3 api error: specified bucket does not exist
The error is stating that bucket does not yet exist. By the looks of your code, the bucket name is not correct, which...
Read more >Resolve S3 Access Denied errors when using an AWS SDK
I can access my Amazon Simple Storage Service (Amazon S3) resources when I use the AWS Command Line Interface (AWS CLI).
Read more >Class: Aws::S3::Client — AWS SDK for Ruby V3
Creates or modifies OwnershipControls for an Amazon S3 bucket. Applies an Amazon S3 bucket policy to an Amazon S3 bucket. Creates a replication...
Read more >Troubleshoot IAM-related Access Denied errors in Amazon S3
If your bucket policy has this condition, the IAM user must access your bucket from the allowed IP addresses. Check for a condition...
Read more >get-object — AWS CLI 1.27.28 Command Reference
If the object you request does not exist, the error Amazon S3 returns depends on whether you also have the s3:ListBucket permission.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
After more digging, it seems like I may be able to force the desired behavior with
s3ForcePathStyle: true
in the S3 SDK configthx for reporting, looks like a Bug.