Excon :: Error :: Forbidden:asset_async轨道中的期望(200)<=>实际(403禁止)

时间:2019-02-25 12:45:27

标签: ruby-on-rails ruby amazon-web-services amazon-s3 asset-pipeline

当我尝试使用命令AssetSync.syncrake assets:precompile与s3异步资产时

这会引发错误

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存储桶策略为:

{
"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": "*"
    }
]
}

如何解决此问题?

0 个答案:

没有答案