AssetSync/asset_sync

Excon::Error::Forbidden: Expected(200) <=> Actual(403 Forbidden)

Opened this issue · 3 comments

When I try to async assets with s3 using command AssetSync.sync or rake assets:precompile

This throw an error

Excon::Error::Forbidden: Expected(200) <=> Actual(403 Forbidden)
excon.error.response

:body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>

S3 bucket policy is

{
"Id": "xxx",
"Version": "2012-10-17",
"Statement": [
    {
        "Sid": "xxx",
        "Action": [
            "s3:ListBucket"
        ],
        "Effect": "Allow",
        "Resource": "arn:aws:s3:::static-assets",
        "Principal": "*"
    },
    {
        "Sid": "xxx",
        "Action": [
            "s3:GetObject",
            "s3:GetObjectAcl",
            "s3:PutObject",
            "s3:PutObjectAcl"
        ],
        "Effect": "Allow",
        "Resource": "arn:aws:s3:::static-assets/*",
        "Principal": "*"
    }
]
}

How to fix this issue?

I think SignatureDoesNotMatch is not related to us
Since this gem just uses fog to upload files
For AWS try to find solultion in fog-aws

Can we use it without fog-aws

If you use AWS then I think fog-aws should be required

https://github.com/AssetSync/asset_sync/blob/v2.6.0/lib/asset_sync/storage.rb
This gem mostly use Fog interface to upload files
You can try to upload one file using same interface without fog-aws and see what happens