Paolo Laurenti Paolo Laurenti - 1 year ago 124
Ruby Question

How to solve error "Missing `secret_key_base` for 'production' environment" (Rails 4.1)

I've created a rails app (rails 4.1) from scratch and I am facing a strange problem that I am not able to solve.

Every time I try to deploy my app on Heroku I get an error 500:

for 'production' environment, set this value in

The secret.yml file contains the following configuration:

secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

On Heroku I have configured an environment variable "SECRET_KEY_BASE" with the result of "rake secret" command. If I launch "heroku config", I can see the variable with the correct name and value.

Why am I still getting this error?

Thanks a lot

Answer Source

Add config/secrets.yml to version control and deploy again. You might need to remove a line from .gitignore so that you can commit the file.

I had this exact same issue and it just turned out that the boilerplate .gitignore Github created for my Rails application included config/secrets.yml.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download