Heroku推送:错误构建失败
我正在开发一个Ruby on Rails 7 Web应用程序,它使用omniauth-linkedin-oauth2 gem进行LinkedIn身份验证。该应用程序在config/credentials.yml.ec中定义的LinkedIn凭据在本地工作正常。然而,当我尝试将应用部署到Heroku时,我在资产预编译期间遇到以下错误: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>'
我想在heroku中推送我的web应用rails 7。
1条答案
按热度按时间disho6za1#
首先,我会确保凭据具有预期的结构,如果它们具有预期的结构,您是否在heroku应用程序上设置了RAILS_MASTER_KEY环境变量?
所有的细节如何做到这一点,你可以找到以下职位https://stackoverflow.com/a/62011825/3142249