【问题标题】:invalid configuration option `:provider'无效的配置选项 `:provider'
【发布时间】:2016-02-14 13:18:34
【问题描述】:

我一直在碰壁,试图让它在生产中发挥作用。出于某种原因,它可以在本地运行,但不能在 heroku 上运行。

我不断收到此错误消息

Sessions#index 中的ArgumentError

invalid configuration option :provider

At first I assume it was because of this!

但后来在进一步挖掘后我发现它指向我的

initializers/aws.rb

CarrierWave.configure do |config|

  config.storage    = :aws
  config.aws_bucket = 'thehatgame'
  config.aws_acl    = :public_read
  config.aws_authenticated_url_expiration = 60 * 60 * 24 * 365


  config.aws_credentials = {
      :provider                 => 'AWS',
      :access_key_id        => ENV['SECRET_KEY'],
      :secret_access_key    => ENV['SECRET_ACCESS_KEY'],
      :region                 => ENV['S3_REGION']
  }

end

欢迎任何帮助,我确实找到了link 来解决类似的问题,但这也没有用

【问题讨论】:

  • 你试过删除那个键吗?当您定义aws_credentials 时,您似乎不需要provider
  • 谢谢@RyanK 因为你是第一个用相同的答案发表评论的人,我相信你

标签: ruby-on-rails amazon-web-services heroku configuration


【解决方案1】:

根据CarrierWave,可以使用如下:

CarrierWave.configure do |config|

  config.storage    = :aws
  config.aws_bucket = 'thehatgame'
  config.aws_acl    = :public_read
  config.aws_authenticated_url_expiration = 60 * 60 * 24 * 365


  config.aws_credentials = {
      access_key_id:      ENV.fetch('SECRET_KEY'),
      secret_access_key:  ENV.fetch('SECRET_ACCESS_KEY'),
      region:             ENV.fetch('S3_REGION')
  }

end

IE 不需要provider 密钥。

【讨论】:

    【解决方案2】:

    我会删除 provider 键。 carrierwave-aws gem readme(我猜你正在使用它或类似的东西)甚至没有提到 provider 键。这可能是一个已被弃用的旧要求。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-04
      • 1970-01-01
      • 1970-01-01
      • 2018-08-03
      • 1970-01-01
      • 1970-01-01
      • 2015-07-11
      • 1970-01-01
      相关资源
      最近更新 更多