我一直收到这个错误:
Aws :: Errors :: MissingRegionError(缺少区域;使用:region选项或导出区域名称为ENV ['AWS_REGION']):
我的回形针配置如下所示:
config.paperclip_defaults = {
:storage => :s3,
:s3_credentials => {
:bucket => ENV['AWS_BUCKET'],
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
}
尝试添加:区域ENV ['AWS_REGION']
config.paperclip_defaults = {
:storage => :s3,
:region => ENV['AWS_REGION'],
:s3_credentials => {
:bucket => ENV['AWS_BUCKET'],
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
}
env中的区域(运行heroku配置时)
AWS_REGION:us-east-1
尝试默认配置。在config / initializers中创建了aws.rb
Aws.config.update({
region: 'us-east-1',
})
仍然无效。
答案 0 :(得分:9)
我通过执行以下操作来实现它:
config.paperclip_defaults = {
:storage => :s3,
:s3_region => ENV['AWS_REGION'],
:s3_credentials => {
:bucket => ENV['AWS_BUCKET'],
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
}
使用以下命令设置其他heroku配置:heroku config:set AWS_REGION = us-east-1
确保您的区域与最新区域对齐:http://docs.aws.amazon.com/general/latest/gr/rande.html#opsworks_region
希望有所帮助!
答案 1 :(得分:5)
您应该尝试:s3_region not:region