简体   繁体   中英

Devise.secret_key was not set error when attempting to push to heroku

I am trying to push my project to heroku and I am getting the error below. I have already tried inserting the secret key into my devise.rb file and I am still unable to push my project. What could be the cause of this?

Devise.secret_key was not set. Please add the following to your Devise initializer:
remote:        
remote:          config.secret_key = '58216f7aa3031f4abcf97b44a526911b4aacf005ffd09c2243cc125d23a01b1d27e941ea4a627f33b6802d3ec821e55ffcf2f609ee570a98b4cb445ccbd29820'

When you setup Devise it doesn't automatically have a secret key set. It's commented out.

If you take a look at the devise initializer config/initializers/devise.rb on line 11 you'll see something like this

# config.secret_key = 'token'

If you uncomment this and push to GitHub, then Heroku everything should push correctly.

Try specifying where Devise should look for the secret key inside your devise.rb file:

config.secret_key = Rails.application.credentials.secret_key_base 

or

config.secret_key = Rails.application.secret_key_base

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM