title: RAILS_MASTER_KEY error on Heroku deployment
body: <p>I am getting the following error while deploying my rails app on Heroku</p>
  
  <pre><code>-----&gt; Installing node-v8.10.0-linux-x64
  -----&gt; Detecting rake tasks
  -----&gt; 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"]
  </code></pre>
  
  <p>Now if I set environment variable RAILS_MASTER_KEY with the value generated from rake secret . I get this error</p>
  
  <pre><code>-----&gt; Installing node-v8.10.0-linux-x64
  -----&gt; Detecting rake tasks
  -----&gt; Preparing app for Rails asset pipeline
         Running: rake assets:precompile
         rake aborted!
         ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage
  </code></pre>
  
  <p>There is a solution on git regarding this.</p>
  
  <p><a href="https://gist.github.com/kaspth/bc37989c2f39a5642112f28b1d93f343" rel="nofollow noreferrer">https://gist.github.com/kaspth/bc37989c2f39a5642112f28b1d93f343</a></p>
  
  <p>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.</p>
  
  <pre><code>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)
  </code></pre>