S3 putObject puts object into folder for some reason
See original GitHub issueVerified on: Node.js: 6.10.0, 8.9.3, 10.11.0 aws-sdk: 2.373.0, 2.360.0 ubuntu 16.04
Code:
const aws = require('aws-sdk');
const s3 = new aws.S3();
const fs = require('fs');
const fileData = fs.readFileSync('./tmp/d');
const Key = 'dkoker';
s3.putObject({
Bucket: 'dkoker-test',
Body: fileData,
Key,
}).promise().then(() => console.log('Object recorded')).catch(e => console.log(e));
Issue description: Put object operation puts object into a folder with bucket name if bucket name contains Key value.
- The result of this operation is the following: bucket
dkoker-test
has a folderdkoker-test
with a filedkoker
inside. - The expected result:
dkoker
file lays inside bucket, no nested folders should exist
In example above: bucket name is dkoker-test
(disregard what it means). Name of file is dkoker
starts with the same characters as name of bucket: dkoker-test
. Here is the list of tested Key values:
dkoker
dkoke
dkok
d
For all of them an intermediate folder was introduced for some reason Once I’ve changed Key value tom
, everything worked as expected
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:5 (2 by maintainers)
Top Results From Across the Web
PutObject - Amazon Simple Storage Service
Setting this header to true causes Amazon S3 to use an S3 Bucket Key for object encryption with SSE-KMS. Specifying this header with...
Read more >S3 put_object() not putting base folder when putting a file with ...
The workaround is creating empty files in some paths to make folders "appear" to exist. But you should not need that.
Read more >Why can't I access a specific folder or file in my Amazon S3 ...
I can't access a certain prefix or object that's in my Amazon Simple Storage Service (Amazon S3) bucket. I can access the rest...
Read more >Amazon S3 Folders Demystified - Skeddly
When you add an object to S3 using the AWS CLI, you must specify it's name (or “key”). $ aws s3api put-object \...
Read more >Amazon S3 - Put object(s) - Fortra
Puts one or more objects into an S3 bucket. You must have write permissions on a bucket to add an object to it....
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
A fix for this was merged. Closing this issue.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.