Paperclip URL与Paperclip expiring_url

时间:2018-04-20 15:58:21

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

我使用像paper rails和aws-sdk这样的回形针。

config.paperclip_defaults = {
:storage => :s3,
:endpoint => ENV['S3_ENDPOINT'],
:s3_credentials => {
  :bucket => ENV['S3_BUCKET_NAME_TEST'],
  :access_key_id => ENV['AWS_ACCESS_KEY_ID'],
  :secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'],
  :s3_region => ENV['AWS_REGION'],
  :s3_host_name => ENV['S3_HOST_NAME']

  }
  }



gem 'rails', '~> 5.2'
gem 'paperclip', '~> 6.0'
gem 'aws-sdk', '~> 3.0', '>= 3.0.1'

我的问题是:
回形针网址为:http://s3.amazonaws.com/bucket
Paperclip Expiring url是:http://bucket.s3-aws-region.amazonaws.com

我在heroku控制台中收到此错误消息:

Seahorse::Client::NetworkingError (unable to connect to `bucket.s3.{region}.amazonaws.com`; SocketError: getaddrinfo: Name or service not known)

使用:

gem 'rails', '4.2.0'
gem 'paperclip', '~> 4.3'
gem 'aws-sdk', '< 2.0'

我的代码有效!

1 个答案:

答案 0 :(得分:0)

如果您使用的是美国东部地区,则无需在核心区域定义区域。 默认情况下,您的东部地区的网址为s3.amazonaws.com