After 24 hours of trying to find the problem with my app. I finally found the problem.
I ran
rake assets:precompile RAILS_ENV=production
Make sure you have some dummy production entry in your local config/database.yml file
production:
<<: *default
database: your_local_database_name
I've come across the same error in 2016 with Rails 4.2.6 and Capistrano 3.4. We were precompiling the assets during the deploy script just before uploading them together with the code, but rake assets:precompile needs some production entry, even if it's just a dummy one. Source: https://github.com/TalkingQuickly/capistrano-3-rails-template/issues/12