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

s3.PutObject: A header you provided implies functionality that is not implemented #122

Closed
pwaller opened this issue Feb 27, 2015 · 2 comments
Labels
guidance Question that needs advice or information.

Comments

@pwaller
Copy link
Contributor

pwaller commented Feb 27, 2015

        resp, err := s3client.PutObject(&s3.PutObjectRequest{
            Bucket: aws.String("mybucket"),
            Key:    aws.String("foo/bar"),
            Body:   r.Body,
        })

I'm getting an err of A header you provided implies functionality that is not implemented. I can't figure out what I might be doing wrong, is there some missing information?

@pwaller
Copy link
Contributor Author

pwaller commented Feb 27, 2015

I think what actually happened is that ContentLength is compulsory. Is this bug then that aws-sdk-go doesn't check that the header is provided?

Is there a way of doing an upload when the size isn't known in advance?

@lsegal
Copy link
Contributor

lsegal commented Mar 2, 2015

@pwaller ContentLength will be calculated automatically by the SDK when it can (there is code for this in develop), but note that it is a required field and cannot be omitted by the SDK (whether it's automatically filled or not).

One trick you can use to get around this restriction is to use multipart uploads, which allows you to send an object as multiple arbitrary sized parts (though you must know the size of each individual part). You can see the multipart upload overview documentation for more information on this technique.

Note that a multipart upload has to be at minimum 5mb, so you would have to buffer that much into memory and determine if you can use this technique before actually initiating the request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

2 participants