I am getting the following error while deploying my rails app on Heroku
-----> Installing node-v8.10.0-linux-x64
-----> Detecting rake tasks
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
Rails::Secrets::MissingKeyError: Missing encryption key to decrypt secrets with. Ask your team for your master key and put it in ENV["RAILS_MASTER_KEY"]
Now if I set environment variable RAILS_MASTER_KEY with the value generated from rake secret . I get this error
-----> Installing node-v8.10.0-linux-x64
-----> Detecting rake tasks
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage
There is a solution on git regarding this.
https://gist.github.com/kaspth/bc37989c2f39a5642112f28b1d93f343
If I implement the method mentioned in the above github issue. I get the the following error that is also regarding the RAILS_MASTER_KEY.
Generating a new higher entropy encryption key in config/secrets.yml.key.
Rotate the encryption key now.
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.1.6/lib/rails/secrets.rb:77:in `handle_missing_key': Missing encryption key to decrypt secrets with. Ask your team for your master key and put it in ENV["RAILS_MASTER_KEY"]
(Rails::Secrets::MissingKeyError)
RAILS_MASTER_KEY should contain the same value that is in the file config/secrets.yml.key in your project on your computer. You only need to copy it from the file and paste it in Heroku settings. You do not need to generate new secret.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With