Reputation: 51
I keep getting this error:
Aws::Errors::MissingRegionError (missing region; use :region option or export region name to ENV['AWS_REGION']):
my paperclip config looks like this:
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']
}
tried to add :region 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']
}
region in env is (when running heroku config)
AWS_REGION: us-east-1
tried to default config. created aws.rb in config/initializers
Aws.config.update({
region: 'us-east-1',
})
still doesn't work.
Upvotes: 4
Views: 7399
Reputation: 101
I got it working by performing the following:
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']
}
Set an additional heroku config by using: heroku config:set AWS_REGION=us-east-1
Ensure your region lines up with the latest regions at: http://docs.aws.amazon.com/general/latest/gr/rande.html#opsworks_region
Hope that helps!
Upvotes: 10