【问题标题】:Rails 4 S3 Error with Papreclip: NoSuchKey No Such KeyPapreclip 的 Rails 4 S3 错误:NoSuchKey 没有这样的键
【发布时间】:2015-12-13 05:26:16
【问题描述】:

我正在尝试确定为什么在尝试使用 Paperclip 将文件上传到 S3 时出现此错误:

[AWS S3 404 0.994093 1 retries] head_object(:bucket_name=>"mybucketname",:key=>"development/images/26/original/picture") AWS::S3::Errors::NoSuchKey No Such Key

s3.yml

development:
  access_key_id: "xxxxxx"
  secret_access_key: "xxxxxx"

production:
  access_key_id: "xxxxxx"
  secret_access_key: "xxxxxx"

开发.rb

 config.paperclip_defaults = {
  :storage => :s3,
  :bucket => 'mybucketname'
  }

用户.rb

has_attached_file :image,
  :storage => :s3,
    :s3_credentials => "#{Rails.root.to_s}/config/s3.yml",
    :s3_protocol => 'https',
    :path => ":rails_env/:attachment/:id/:style/:filename",
    :bucket => "mybucketname",
    styles: { 
      medium: "300x300>", 
      thumb: "100x100>" } 

宝石文件

gem "paperclip", "~> 4.3"
gem 'aws-sdk-v1'

我已尝试删除 paths3_protocol,但出现类似错误。

我尝试将访问密钥移动到development.rb。另外,我暂时设置了bucket权限,允许大家上传。

【问题讨论】:

    标签: ruby-on-rails-4 amazon-web-services amazon-s3 paperclip


    【解决方案1】:

    我找到了答案here。在设置我的存储桶时,我没有设置我的安全策略。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-21
      • 1970-01-01
      • 2014-07-22
      • 1970-01-01
      • 2021-12-16
      • 2022-01-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多