Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am trying to deploy my application in heroku, but I can not do anything because of this error:

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"]

Can someone help me?

like image 272
Mateus Teixeira Avatar asked Jun 01 '17 04:06

Mateus Teixeira


2 Answers

If you try with the 'previous' method of generating secret keys, with rails secret or rake secret, then you'll end up with another error: ArgumentError: key must be 16 bytes.

The easiest way to make this work with Heroku is:

heroku config:set RAILS_MASTER_KEY=`cat config/master.key`

or just take the first 32 characters (16 bytes) from rails secret

like image 126
januszm Avatar answered Oct 01 '22 08:10

januszm


heroku config:set RAILS_MASTER_KEY=`rake secret`
like image 27
Josh Brody Avatar answered Oct 01 '22 08:10

Josh Brody