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 Direct Upload with Sigv4 #3983

Open
bitmega opened this issue Jan 31, 2020 · 7 comments
Open

S3 Direct Upload with Sigv4 #3983

bitmega opened this issue Jan 31, 2020 · 7 comments

Comments

@bitmega
Copy link

bitmega commented Jan 31, 2020

Sharetribe Version:

https://github.com/sharetribe/sharetribe/tree/6cb337f45f7ba6fc64f7078fa5f72edbdd302076

Environment:

AWS EC2, Ubuntu 18

node v10.16.3
npm 6.9.0

Server mode:

production

Description:

Can not direct upload image to AWS S3 , error message The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256

Steps To Reproduce:

Step 1: Access New/Edit Listing page

Step 2: Upload images

Expected result: 200

Actual result: 400 with error message The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256

Additional information

s3_region: 'ca-central-1'

@thomasmalbaux
Copy link
Contributor

Hey there,

and thanks for reporting!

Hmm that sounds like something is wrong with your own setup, but this is not directly related to the code of Sharetribe Go.

Don't hesitate to discuss this with other users of the Community Edition, at https://www.sharetribe.com/community/! Possibly, someone who uses a similar infrastructure will be able to share their settings, to guide you through our own specific setup.

Keep up the good work!

@bitmega
Copy link
Author

bitmega commented Jan 31, 2020

@thomasmalbaux
Copy link
Contributor

Thanks for sharing!

Hmm I'm not sure about the exact answer here, that indeed requires a bit more investigation. We'll have a look in the upcoming days, most likely next week. Stay tuned!

@thomasmalbaux thomasmalbaux reopened this Jan 31, 2020
@bladealslayer
Copy link
Member

Indeed, Go currently uses v2 signatures for S3 uploads: https://github.com/sharetribe/sharetribe/blob/master/app/services/s3_uploader.rb#L62

Uploads will only work in S3 regions that were launched before 2014, such as us-east-1, eu-west-1, etc. Until we release an update that support v4 signatures, you can workaround this issue by using an older S3 region.

@EugeneKey
Copy link

I added support for v4 signatures for S3 uploads for some projects that use S3 Bucket in Europe and Asia since there is no support for v2 signatures. I can try to send a pull request soon.

@MaikeMota
Copy link

I added support for v4 signatures for S3 uploads for some projects that use S3 Bucket in Europe and Asia since there is no support for v2 signatures. I can try to send a pull request soon.

@EugeneKey can u share a gist with the fix for us? So we can use right now until you can accomplish the PR.

Thanks for now!

@EugeneKey
Copy link

@EugeneKey can u share a gist with the fix for us? So we can use right now until you can accomplish the PR.

Just update your app/services/s3_uploader.rb:
https://gist.github.com/EugeneKey/969113ff62eaa910a505abb7a5c44e91

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

5 participants