I received the error "An unhandled lowlevel error occurred" when deploying my app for the first time on Heroku, and heroku logs
shows:
Missing
secret_key_base
for 'production' environment, set this value inconfig/secrets.yml
1) The default secrets.yml
specifies secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
for production
2) I generated a secret using rails secret
, then added this to my app's Heroku config via heroku config:set SECRET_KEY_BASE='(the key)'
3) heroku config
shows this value set for SECRET_KEY_BASE
4) Perhaps most importantly, based on older questions regarding this error, .gitignore
does not include secrets.yml
--it's the default .gitignore generated for a Rails 5 app. Therefore, secrets.yml
should have been deployed with my app, which specifies that the secret be loaded via an environment variable in the production environment.
5) I've also run heroku ps:restart
, in case the app needed some extra help for the environment variable setting to take effect
I read older posts, but the past answer seemed to be ensuring secrets.yml
was not included in .gitignore
, but as mentioned, this does not apply to the default Rails 5 .gitignore
.
What else can I try? Thx.
Edit: When I set the config value at the command line, I also receive the Heroku message:
Setting SECRET_KEY_BASE and restarting (the app)... done
heroku config
shows that this variable is set. I've also used the Web UI, clicked 'Reveal Config Vars' under 'Config Variables' and see it listed there. Anything else I should try? I also tried settingRAILS_ENV
to production prior to generating the key a second time, and updating the Heroku config with this new value (and again verifying). – SexxLuthor