Automattic / Automattic/knox

Error uploading a file

Open
#311 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.7k
Forks
283
PR merge metrics
No merged PRs in 30d

Description

I'm using this code for uploading an image, I follow the docs but I'm getting an 301 error from amazon. Is this a bug in knox? The amazon cli uploads my files just fine.

``` javascript
require('dotenv').config()
var knox = require('knox')

var client = knox.createClient({
key: process.env.S3_KEY,
secret: process.env.S3_SECRET,
bucket: process.env.S3_BUCKET
});

var file = "image.jpg"
var upload_name = "upload_" + file

client.putFile(file, upload_name, {"Content-Type": "image/jpeg"}, function (err, result) {
if (err != null) {
return console.log(err)
} else {
console.log(result.statusCode)
return console.log("Uploaded to amazon S3")
}
})
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with the provided JavaScript client.putFile example and inspect the returned 301 response and request configuration. Trace the upload path used by putFile; done means the redirect cause is identified and the upload behavior is verified with a focused regression check.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript
Domain
cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.