question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

S3 putObject puts object into folder for some reason

See original GitHub issue

Verified 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 folder dkoker-test with a file dkoker 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 to m, everything worked as expected

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
srchasecommented, Dec 19, 2018

A fix for this was merged. Closing this issue.

0reactions
lock[bot]commented, Sep 29, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found