Skip to content

Can't get simple putStream() script to work... #92

@TooTallNate

Description

@TooTallNate
var s3 = require('s3') // s3 is an initialized knox S3 Client instance
var fs = require('fs')
var file = '/Users/nrajlich/Pictures/avatar.jpg'; // This is a valid JPG file that does exist

var headers = {};
headers['Content-Type'] = 'image/jpeg';

var res = fs.createReadStream(file);
var s3req = s3.putStream(res, '/nate-avatar.jpg', headers, function(err, s3res){
  if (err) throw err;
  console.log(s3res.statusCode);
  console.log(s3res.headers);
  s3res.pipe(process.stdout, {end: false});
  console.error('s3 callback', s3req.url);
});
s3req.on('progress', console.log);

Using knox v0.3.0, this script makes S3 return a 501 error code, with the following XML body:

<Error>
  <Code>NotImplemented</Code>
  <Message>A header you provided implies functionality that is not implemented</Message>
  <Header>Transfer-Encoding</Header><RequestId>7A05E23CB3DBBD1E</RequestId>
  <HostId>Dylx7eIcmXceZCEOZKmMxpGclu2i5bsdlV6pdyH8uAzNm+DAXPE/vdrFkFwFaHht</HostId>
</Error>

Not sure if this is misuse on my part or a problem with knox, but it's kinda holding me up at the moment :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions