Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't decrypt config/credentials.yml.enc

I am using Heroku with Rails 6 and Postgres. I am trying to use heroku open to start the app, but the build fails and this is shown in the logs:

-----> Detecting rake tasks
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       DEPRECATION WARNING: Including LoggerSilence is deprecated and will be removed in Rails 6.1. Please use `ActiveSupport::LoggerSilence` instead (called from <top (required)> at /tmp/build_9537ba0878cb8933c15686548eb3ccb5/config/application.rb:7)
       Missing encryption key to decrypt file with. Ask your team for your master key and write it to /tmp/build_9537ba0878cb8933c15686548eb3ccb5/config/master.key or put it in the ENV['RAILS_MASTER_KEY'].
 !
 !     Precompiling assets failed.
 !
 !     Push rejected, failed to compile Ruby app.
 !     Push failed

I have tried to run some of the commands mentioned in these two links, but none seem to work:

https://github.com/rails/rails/issues/32947

Ask your team for your master key and put it in ENV["RAILS_MASTER_KEY"] on heroku deploy

I'm also wondering if these workflows are environment specific.

like image 274
Spencer K. Avatar asked Jan 23 '26 07:01

Spencer K.


1 Answers

You need to add the rails master key as an environment variable to heroku.

  1. Copy the master key in the config/master.key file in your computer
  2. Add master key to heroku as environment variable

    heroku config:set RAILS_MASTER_KEY=your-master-key
    
like image 143
demir Avatar answered Jan 24 '26 21:01

demir



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!