Reputation: 5
Heroku push : Error Build failed
I am developing a Ruby on Rails 7 web application that uses the omniauth-linkedin-oauth2 gem for LinkedIn authentication. The app works fine locally with the LinkedIn credentials defined in config/credentials.yml.enc. However, when I try to deploy the app to Heroku, I get the following error during asset precompilation: vbnet
NoMethodError: undefined method `[]' for nil:NilClass config.omniauth :linkedin, Rails.application.credentials[:linkedin][:client_id], Rails.application.credentials[:linkedin][:client_secret]
I have checked that the LinkedIn credentials are correctly set up in both config/credentials.yml.enc and on the Heroku app’s config vars.
Fetching sassc-rails 2.1.2
Installing sassc-rails 2.1.2
Installing font-awesome-sass 6.4.0
Bundle complete! 24 Gemfile dependencies, 81 gems now installed.
Gems in the groups 'development' and 'test' were not installed.
Bundled gems are installed into `./vendor/bundle`
Post-install message from devise:
[DEVISE] Please review the [changelog] and [upgrade guide] for more info on Hotwire / Turbo integration.
[changelog] https://github.com/heartcombo/devise/blob/main/CHANGELOG.md
[upgrade guide] https://github.com/heartcombo/devise/wiki/How-To:-Upgrade-to-Devise-4.9.0-%5BHotwire-Turbo-integration%5D
Post-install message from oauth2:
You have installed oauth2 version 2.0.9, congratulations!
There are BREAKING changes if you are upgrading from < v2, but most will not encounter them, and updating your code should be easy!
We have made two other major migrations:
1. master branch renamed to main
2. Github has been replaced with Gitlab
Please see:
• https://gitlab.com/oauth-xx/oauth2#what-is-new-for-v20
• https://gitlab.com/oauth-xx/oauth2/-/blob/main/CHANGELOG.md
• https://groups.google.com/g/oauth-ruby/c/QA_dtrXWXaE
Please report issues, and support the project! Thanks, |7eter l-|. l3oling
Bundle completed (86.58s)
Cleaning up the bundler cache.
-----> Installing node-v16.18.1-linux-x64
-----> Installing yarn-v1.22.19
-----> Detecting rake tasks
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
NoMethodError: undefined method `[]' for nil:NilClass
config.omniauth :linkedin, Rails.application.credentials[:linkedin][:client_id], Rails.application.credentials[:linkedin][:client_secret]
^^^^^^^^^^^^
/tmp/build_22da9b42/config/initializers/devise.rb:14:in `block in <main>'
/tmp/build_22da9b42/vendor/bundle/ruby/3.1.0/gems/devise-4.9.2/lib/devise.rb:314:in `setup'
/tmp/build_22da9b42/config/initializers/devise.rb:11:in `<main>'
/tmp/build_22da9b42/vendor/bundle/ruby/3.1.0/gems/railties-7.0.4.3/lib/rails/engine.rb:667:in `load'
/tmp/build_22da9b42/vendor/bundle/ruby/3.1.0/gems/railties-7.0.4.3/lib/rails/engine.rb:667:in `block in load_config_initializer'
/tmp/build_22da9b42/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4.3/lib/active_support/notifications.rb:208:in `instrument'
/tmp/build_22da9b42/vendor/bundle/ruby/3.1.0/gems/railties-7.0.4.3/lib/rails/engine.rb:666:in `load_config_initializer'
/tmp/build_22da9b42/vendor/bundle/ruby/3.1.0/gems/railties-7.0.4.3/lib/rails/engine.rb:620:in `block (2 levels) in <class:Engine>'
I want to push my web app rails 7 in heroku..
Upvotes: 0
Views: 115
Reputation: 378
First of all I would ensure that credentials have expected structure, if they do, did You set RAILS_MASTER_KEY environment variable on Your heroku app ?
All the details how to do it You can find on following post https://stackoverflow.com/a/62011825/3142249
Upvotes: 0