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.
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")
}
})
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.