5

I made this on my server:

deploy@ubuntu-512mb-ams2-01:~/applications/spa_backend/current$ bundle exec rake secret
4b921910**
deploy@ubuntu-512mb-ams2-01:~/applications/spa_backend/current$ export SECRET_KEY_BASE=4b921910**
deploy@ubuntu-512mb-ams2-01:~/applications/spa_backend/current$ irb
irb(main):001:0> ENV["SECRET_KEY_BASE"]
=> "4b921910**"

And when I try open link with my app, I see this:

An unhandled lowlevel error occurred. The application logs may have details.

puma_error.log:

#<RuntimeError: Missing `secret_key_base` for 'production' environment, set this value in `config/secrets.yml`>
/home/deploy/applications/spa_backend/shared/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/application.rb:513:in `validate_secret_key_config!'
/home/deploy/applications/spa_backend/shared/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/application.rb:246:in `env_config'

secrets.yml:

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

UPD. I changed <%= ENV["secret_key_base"] %> -> <%= ENV["SECRET_KEY_BASE"] %> but it didn't help

Pavel
  • 2,103
  • 4
  • 23
  • 41
  • Does this answer your question? [An unhandled lowlevel error occurred. The application logs may have details](https://stackoverflow.com/questions/37112804/an-unhandled-lowlevel-error-occurred-the-application-logs-may-have-details) – cbr Sep 15 '22 at 20:51

3 Answers3

9

In your secrets.yml, your environment variable key needs to be capitalized. Calling ENV['secret_key_base'] is returning nil.

Modify your secrets.yml like below:

production:
  secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
treiff
  • 1,246
  • 14
  • 24
5

You have to produce the 'secret_key_base' first.

bundle exec rake secret

The code above will produce the necessary key. Copy it and replace <%= ENV["SECRET_KEY_BASE"] %> with it.

Here is the original post:

An unhandled lowlevel error occurred. The application logs may have details

Community
  • 1
  • 1
Nyein
  • 276
  • 3
  • 11
-7

If you use GitHub, check your .gitignore file. .gitignore template for Rails application includes config/secrets.yml and error resolves by commenting out the line.