Heroku upload-Precompiling assets failed

From the Heroku docs:

This means that your app is attempting to connect to the database as part of rake assets:precompile. Because the config vars are not present in the environment, we use a placeholder DATABASE_URL to satisfy Rails.

To resolve this issue, ensure that the following line appears in your config/application.rb:

# config/application.rb
config.assets.initialize_on_precompile = false

Once added, commit your change and redeploy to Heroku – your assets should compile without your app attempting to connect to the database, which should resolve the error you’re witnessing.

UPDATE:

Line 46 of your stacktrace includes the following message: Devise.secret_key was not set.

According to the author of Devise, José Valim, this issue can be resolved in the following manner:

Please add the following to your Devise initializer:

config.secret_key = ‘– secret key –‘

Alternatively, the following solution seems to have worked for a number of users:

I went to my routes.rb file and commented out the line devise_for :installs

Then I went back and reran rails generate devise:install. If that doesn’t work, use the previous version of devise by editing your Gemfile’s reference to Devise like this: gem ‘devise’, ‘3.0.3’ and then follow the steps i mentioned above.

Leave a Comment