Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 5.2 credentials.yaml.enc and master.key not working on Heroku

I'm setting up active storage for a new app, and haven't been able to get the app running on production after setting up my amazon credentials.

  1. I've included my s3 bucket credentials in my credentials.yaml.enc file
  2. I've added my RAILS_MASTER_KEY env variable to Heroku.
  3. I've set up my s3 bucket in the storage.yml file according to this.
  4. I've added the config.active_storage.service = :amazon line to my production.rb.
  5. I've added config.require_master_key = true to my production.rb

When I try running my app on Heroku, it doesn't load. Doing $ Heroku run rails console gives me the error:

"/app/vendor/bundle/ruby/2.3.0/gems/aws-sigv4-1.0.2/lib/aws-sigv4/signer.rb:517:in `extract_credentials_provider': Cannot load `Rails.config.active_storage.service`: (Aws::Sigv4::Errors::MissingCredentialsError)
missing credentials, provide credentials with one of the following options:
- :access_key_id and :secret_access_key
- :credentials
- :credentials_provider"

As far as I can tell I've set up my credentials the way Rails 5.2 intended. I've tried all sorts of asset precompiling stuff to no avail. When I try adding my amazon credentials as env. variables in Heroku, the app runs fine in production. Any idea what could be going wrong here?

like image 850
spitz Avatar asked May 16 '18 07:05

spitz


1 Answers

Could it be that you forgot to add config.require_master_key = true to your production.rb?

like image 128
Quico Moya Avatar answered Sep 17 '22 13:09

Quico Moya