首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Refile返回Aws::S3::Errors::禁止: error

Refile返回Aws::S3::Errors::禁止: error
EN

Stack Overflow用户
提问于 2018-03-13 23:12:12
回答 1查看 620关注 0票数 1

突然之间,Refile gem在尝试从S3存储桶中获取图像时,开始抛出Aws::S3::Errors::Forbidden:错误。虽然我可以上传/获取新图像,但此问题仅发生在较旧的文件中。

我尝试向S3添加新的存储桶策略,就像这里提到的:https://github.com/aws/aws-sdk-ruby/issues/201,但似乎没有一个对我有效,可能是我写得不正确。

代码语言:javascript
复制
{
"Version": "2012-10-17",
"Statement": [
    {
        "Effect": "Allow",
        "Principal": "*",
        "Action": "s3:*",
        "Resource": [
            "arn:aws:s3:::bucket/*",
            "arn:aws:s3:::bucket"
        ]
    }
]
}

以下是错误日志:

代码语言:javascript
复制
Aws::S3::Errors::Forbidden:
from /home/deploy/hutfy/shared/bundle/ruby/2.3.0/gems/aws-sdk-resources-2.6.4/lib/aws-sdk-resources/resource.rb:134:in `rescue in exists?'
from /home/deploy/hutfy/shared/bundle/ruby/2.3.0/gems/aws-sdk-resources-2.6.4/lib/aws-sdk-resources/resource.rb:131:in `exists?'
from /home/deploy/hutfy/shared/bundle/ruby/2.3.0/gems/refile-s3-0.2.0/lib/refile/s3.rb:126:in `exists?'
from /home/deploy/hutfy/shared/bundle/ruby/2.3.0/bundler/gems/refile-d7a42dcd7cf6/lib/refile/backend_macros.rb:11:in `block (2 levels) in verify_id'
from /home/deploy/hutfy/shared/bundle/ruby/2.3.0/bundler/gems/refile-d7a42dcd7cf6/lib/refile/file.rb:53:in `exists?'
from (irb):3
from /home/deploy/hutfy/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/commands/console.rb:110:in `start'
from /home/deploy/hutfy/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/commands/console.rb:9:in `start'
from /home/deploy/hutfy/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:68:in `console'
from /home/deploy/hutfy/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/deploy/hutfy/shared/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:8:in `require'
from bin/rails:8:in `<main>'
EN

回答 1

Stack Overflow用户

发布于 2018-03-13 23:49:02

原来服务器和S3的时钟不同步。运行以下命令解决了此问题:

代码语言:javascript
复制
sudo apt-get install ntp
service ntp stop
sudo ntpdate -s 0.amazon.pool.ntp.org
service ntp start
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49259650

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档