I've been struggling with this problem for a day now and can't find anything else online to help. I have a Rails 4 application where I'm using AWS S3 and the paperclip gem to host user avatars. I've set my Heroku config variables for the bucket, access key ID, and secret key as well as the region. However, I keep getting this error in my Heroku logs whenever I try uploading a picture on the heroku app:
Aws::Errors::MissingRegionError (missing region; use :region option or export region name to ENV['AWS_REGION']):
In my production.rb file, I have this code:
app/config/environments/production.rb
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']
}
}
I've followed this link closely (https://devcenter.heroku.com/articles/paperclip-s3) but still not sure why I keep getting the error. I've also tried hardcoding 'us-west-1'
and that doesn't work.
In the heroku console:
irb(main):001:0> ENV['AWS_REGION']
=> "us-west-1"
Any help would be appreciated.