Devise Secret Key was not set

user1139144 picture user1139144 · Aug 6, 2013 · Viewed 87.4k times · Source

I am developing a Rails 4 app using the Active Admin gem for the administration back end. Active Admin in turn uses Devise for user authentication. Now, when I try to deploy the app using capistrano on the VPS server, I get the below error:

rake aborted!
Devise.secret_key was not set. Please add the following to your Devise initializer:
config.secret_key = '-- secret key --'

A Google search does not do much for this error. Any suggestions why it is throwing an error? Should I add the secret key to devise initializer, as I cannot find any place to set such config key in initializers/devise.rb?

Answer

Brian Weiner picture Brian Weiner · Aug 6, 2013

I ran bundle update this morning and started getting the same error.

I added it as a line in config/initializers/devise.rb and the error was fixed.

This seems to be the commit which introduced it.