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

Support for AWS Signature Version 4 #3

Closed
michaelthorne opened this issue Apr 12, 2017 · 7 comments
Closed

Support for AWS Signature Version 4 #3

michaelthorne opened this issue Apr 12, 2017 · 7 comments
Assignees

Comments

@michaelthorne
Copy link
Contributor

This is also an issue in the gulp-s3 plugin, but mentioning it here too.

I've been unable to upload to certain (newer) S3 regions and it is as a result of them only supporting V4. i.e. eu-west-2 (London) as a region, returns an ambiguous HTTP 400 error when attempting to publish files to a bucket in that region.

Message:
    [400] C:\file.css.gz -> file.css
Stack:
Error: [400] C:\file.css.gz -> file.css
    at DestroyableTransform.uploadCallback (C:\node_modules\gulp-s3-publish\index.js:76:24)

If I only switch the region to e.g. us-east-1 (formerly US Standard which supports V2 and V4) and leave everything else as is, the publish works as expected.

@adrianfalleiro
Copy link
Owner

Cheers @michaelthorne, it looks like knox does not support the V4 Signature, and there's an un-merged PR thats been open the last 2 years to add support (Automattic/knox#273).

Might need to refactor using aws-sdk or another streaming library like knox

@adrianfalleiro adrianfalleiro self-assigned this Apr 12, 2017
@michaelthorne
Copy link
Contributor Author

@adrianfalleiro that would be awesome!

@adrianfalleiro
Copy link
Owner

adrianfalleiro commented Apr 13, 2017

@michaelthorne can you try with the master branch and let me know if that works for you?

You can install it by running npm install git+https://github.com/adrianfalleiro/gulp-s3-publish

If it's working for you, I'll clean up and publish to npm

@michaelthorne
Copy link
Contributor Author

@adrianfalleiro thanks for the quick update! I got the following error after installing it as per your comment above:

Message:
    TypeError: Cannot read property 'statusCode' of null
Stack:
Error: TypeError: Cannot read property 'statusCode' of null
    at DestroyableTransform.<anonymous> (C:\test\node_modules\gulp-s3-publish\index.js:89:32)
    at DestroyableTransform._transform (C:\test\node_modules\through2-concurrent\through2-concurrent.js:30:15)
    at DestroyableTransform.Transform._read (C:\test\node_modules\readable-stream\lib\_stream_transform.js:159:10)
    at DestroyableTransform.Transform._write (C:\test\node_modules\readable-stream\lib\_stream_transform.js:147:83)
    at doWrite (C:\test\node_modules\readable-stream\lib\_stream_writable.js:345:64)
    at writeOrBuffer (C:\test\node_modules\readable-stream\lib\_stream_writable.js:334:5)
    at DestroyableTransform.Writable.write (C:\test\node_modules\readable-stream\lib\_stream_writable.js:271:11)
    at write (C:\test\node_modules\gulp-gzip\node_modules\readable-stream\lib\_stream_readable.js:623:24)
    at flow (C:\test\node_modules\gulp-gzip\node_modules\readable-stream\lib\_stream_readable.js:632:7)
    at Transform.pipeOnReadable (C:\test\node_modules\gulp-gzip\node_modules\readable-stream\lib\_stream_readable.js:664:5)

FYI, using eu-west-2 as a region.

@adrianfalleiro
Copy link
Owner

Cheers @michaelthorne. I've fixed that issue with the error messaging. However I haven't done any testing for uploading gzipped files so that might also be an issue.

I see gulp-gzip in that stack trace. Are you gzipping files?

@adrianfalleiro
Copy link
Owner

Ok got it working with gzip. Can you try again and let me know if working.

Cheers

@adrianfalleiro
Copy link
Owner

Tested and released on npm as 2.0.0.

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