Mateus Teixeira
Mateus Teixeira

Reputation: 111

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?

Upvotes: 9

Views: 9010

Answers (3)

Herat Patel
Herat Patel

Reputation: 798

there are two ways to solve this problem.

  1. create secrets.yml.key file which contains the key(encrypted).
  2. heroku config:set RAILS_MASTER_KEY=rake secret.

Upvotes: 0

januszm
januszm

Reputation: 1245

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

Upvotes: 8

Josh Brody
Josh Brody

Reputation: 5363

heroku config:set RAILS_MASTER_KEY=`rake secret`

Upvotes: 5

Related Questions