Matt Gaidica
Matt Gaidica

Reputation: 13

Error after Detecting Rails Configuration on Heroku

My rails app is working locally, however, I'm running into issues upon deploying to Heroku. It appears it's precompiling fine, but I get a stack of errors here:

remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        Yarn executable was not detected in the system.
remote:        Download Yarn at https://yarnpkg.com/en/docs/install
remote:        Asset precompilation completed (1.79s)
remote:        Cleaning assets
remote:        Running: rake assets:clean
remote: -----> Detecting rails configuration
remote:        $ rails runner "begin; puts %Q{heroku.detecting.config.for.assets.compile=#{Rails.application.config.try(:assets).try(:compile)}}; rescue => e; puts e; puts e.backtrace; end; begin; puts %Q{heroku.detecting.config.for.action_dispatch.x_sendfile_header=#{Rails.application.config.try(:action_dispatch).try(:x_sendfile_header)}}; rescue => e; puts e; puts e.backtrace; end; begin; puts %Q{heroku.detecting.config.for.active_storage.service=#{Rails.application.config.try(:active_storage).try(:service)}}; rescue => e; puts e; puts e.backtrace; end;"
remote:        /tmp/build_e5c8ea775fe1792a905edb1b8e4870ab/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.1/lib/active_support/message_encryptor.rb:206:in `rescue in _decrypt': ActiveSupport::MessageEncryptor::InvalidMessage (ActiveSupport::MessageEncryptor::InvalidMessage)
remote:        	from /tmp/build_e5c8ea775fe1792a905edb1b8e4870ab/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.1/lib/active_support/message_encryptor.rb:183:in `_decrypt'
remote:        	from /tmp/build_e5c8ea775fe1792a905edb1b8e4870ab/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.1/lib/active_support/message_encryptor.rb:157:in `decrypt_and_verify'

Any thoughts? Thanks!

Upvotes: 1

Views: 286

Answers (1)

Tony Vincent
Tony Vincent

Reputation: 14272

The error is the result of Heroku missing the master key for decrypting the credentials file. Create a RAILS_MASTER_KEY ENV variable., Rails will detect this automatically and use it as your master key for decryption.

For heroku: $ heroku config:set RAILS_MASTER_KEY=<your-master-key-here>

This is a very nice blog post to understand how rails credentials API work

Upvotes: 2

Related Questions