Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

501 Transfer-Encoding not implemented on a PUT. Wtf? #43

Closed
nickretallack opened this issue Oct 30, 2011 · 2 comments
Closed

501 Transfer-Encoding not implemented on a PUT. Wtf? #43

nickretallack opened this issue Oct 30, 2011 · 2 comments

Comments

@nickretallack
Copy link

I'm trying to use knox to put some data on S3 but it always fails with a 501. Here's my code. Ignore the extra returns -- it's generated from coffee-script.

  knox = require('knox');
  s3 = knox.createClient({####SECRET####})
  test_s3 = function() {
    var buffer, request;
    buffer = new Buffer(6);
    buffer.write("Hello");
    request = s3.put('test-key');
    return request.on('response', function(response) {
      console.log(response.statusCode);
      return response.on('data', function(data) {
        return console.log(data.toString('ascii'));
      });
    });
  };
  test_s3();

What I get on the console is this:

501
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NotImplemented</Code><Message>A header you provided implies functionality that is not implemented</Message><Header>Transfer-Encoding</Header><RequestId>67F400ED6D76C07A</RequestId><HostId>oyEU9C4gk/Kf6PQta2roQ2q0Pe1cfvi1BeoVUhsEPNV5qf/39ZmOVXCn5HqdCZtq</HostId></Error>

This doesn't make sense to me. Googling around, I found that S3 usually returns this response when you try and do some operation that shouldn't send any content, but you sent content anyway. But this is a put. It's supposed to have content. Looking through the request object, it appears that content length is set and the body is being written as it should be. So what is going wrong?

@nickretallack
Copy link
Author

Oh, this is what happens when I don't send the content length. Also in this example code I forgot to send the buffer too. Whoops.

@pflammertsma
Copy link

This issue was really useful to me, as it wasn't evident that "Content-Length" was a mandatory field. Totally obvious, but the response error is very confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants