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

problem with header modifications for public upload #4

Open
malgorithms opened this issue Mar 15, 2013 · 5 comments
Open

problem with header modifications for public upload #4

malgorithms opened this issue Mar 15, 2013 · 5 comments

Comments

@malgorithms
Copy link

hi - I'm successfully using mpu, and have code like this:

upload = new mpu {
          client:       @s3client
          objectName:   fname
          file:         lname
        }, (err, res) -> ### buncha stuff here ###

These uploads always work.

However, as soon I use a header designed to make my file public-readable, I get a vague error. Here's my mod; the only difference is the intro of the header:

public_header = {
      'x-amz-acl':    'public-read'
}
upload = new mpu {
          client:       @s3client
          objectName:   fname
          file:         lname
          headers:      public_header
        }, (err, res) -> ### buncha stuff here ###

I'm getting an err which I print:

Unable to initiate stream upload

This doesn't tell me much. Have I misused mpu, perhaps?

Thanks!

@dmkelly
Copy link

dmkelly commented Mar 19, 2013

I'm getting the same issue while streaming an image. The image uploads without issue if I don't provide additional headers, but fails once I provide a Content-Type or x-amz-acl header. The error that causes knox-mpu to callback with an error is the following (partial) response from AWS:

Code: 'SignatureDoesNotMatch',
Message: 'The request signature we calculated does not match the signature you provided. Check your key and signing method.'

@malgorithms
Copy link
Author

this issue remains, but @dmkelly I have a workaround that works in my case (perhaps not yours). I used AWS's policy generator to set everything in my upload folder to public-read.

The problem of course is that I had to do it for the whole folder (which I don't want to do), and it doesn't solve your issue with Content-Type. But you might try this in the short term until this is fixed or we get some feedback from @nathanoehlman

@dmkelly
Copy link

dmkelly commented Mar 20, 2013

I ended up examining my data more closely and realized that I could probably get away with single file uploads instead of multi-part uploads and am instead using the AWS SDK so I am no longer affected by this issue.

@pwaleczek
Copy link

Having the same problem right now and while investigating, I found that this module uses a POST request to initiate the upload, not a PUT. Because of that the headers are discarded. The params in this case need to be a part od the form data, as described here: http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOST.html
Will drop this module in favor of a custom code for what I need...

@adriancooney
Copy link

Exact same problem here. Any update on this?

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

4 participants