當我嘗試上傳到s3時出現此錯誤。我檢查了一下,以確保我的新聞憑據是正確的。這是我得到的錯誤。當使用carrierwave/fog上傳到aws時,所有對此對象的訪問都被禁用s3
```
Excon::Errors:`:Forbidden: Expected(200) <=> Actual(403 Forbidden)
excon.error.response
:body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>AllAccessDisabled</Code><Message>All access to this object has been disabled</Message><RequestId></RequestId><HostId></HostId></Error>"
:cookies => [
]
:headers => {
"Connection" => "close"
"Content-Type" => "application/xml"
"Date" => "Fri, 13 May 2016 22:14:48 GMT"
"Server" => "AmazonS3"
"x-amz-id-2" => ""
"x-amz-request-id" => ""
}
:host => "s3.amazonaws.com"
:local_address => "10.0.0.24"
:local_port => 57133
:path => "/uploads/script/file/1/Facebook-2006.jpg"
:port => 443
:reason_phrase => "Forbidden"
:remote_ip => "54.231.114.148"
:status => 403
:status_line => "HTTP/1.1 403 Forbidden\r\n"
```
這就是我如何配置carrierwave /霧 配置/初始化/ carrierwave.rb CarrierWave.configure do |config| config.fog_credentials = { provider: "AWS", aws_access_key_id: ENV["AWS_ACCESS_KEY_ID"], aws_secret_access_key: ENV["AWS_SECRET_ACCESS_KEY"] } config.fog_directory = ENV["AWS_S3_BUCKET"] end
超容易犯的錯誤,很高興你能夠解決它。 – geemus
我做了一個類似的錯誤,我命名了一個不存在的桶...... – phoenix
哈哈哈好東西有這個錯誤的問題。我犯了錯誤的桶名稱相同的錯誤。該消息應該更具信息性。 –