doorkeeper: rails generate doorkeeper:install failing due to missing configuration
While trying to install doorkeeper 4.2.6 into an existing Rails 5.0.1 application, I ran into the following problem:
$ rails generate doorkeeper:install
~/.rvm/gems/ruby-2.3.3@clear_value_plus/gems/doorkeeper-4.2.6/lib/doorkeeper/config.rb:18:in `configuration': Configuration for doorkeeper missing. Do you have doorkeeper initializer? (Doorkeeper::MissingConfiguration)
from ~/.rvm/gems/ruby-2.3.3@clear_value_plus/gems/doorkeeper-4.2.6/app/controllers/doorkeeper/application_controller.rb:3:in `<module:Doorkeeper>'
from ~/.rvm/gems/ruby-2.3.3@clear_value_plus/gems/doorkeeper-4.2.6/app/controllers/doorkeeper/application_controller.rb:1:in `<top (required)>'
from ~/.rvm/gems/ruby-2.3.3@clear_value_plus/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:477:in `load'
from ~/.rvm/gems/ruby-2.3.3@clear_value_plus/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:477:in `block in load_file'
from ~/.rvm/gems/ruby-2.3.3@clear_value_plus/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:662:in `new_constants_in'
from ~/.rvm/gems/ruby-2.3.3@clear_value_plus/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:476:in `load_file'
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 24 (8 by maintainers)
Under Rails 7, I had to comment the following line of
config/environment.rbfor the setup to workI was facing the exact issue, and found the solution.
It could fail if you have
config.eager_load = trueinconfig/environments/development.rbIf you closely look at the stack-trace of error below, it’s clear that
doorkeeper/application_controlleris being called byeager_load!inengine.rb. So, I went toconfig/environments/developement.rband setconfig.eager_load = false, and thenrails g doorkeeper:installworked smoothly.Thanks @nbulaj for the subtle hint.
Had the same problem, looks like rails loads up
Doorkeeper::ApplicationControllerwhich callsDoorkeeper.configurationwhich in turn will fail withDoorkeeper::MissingConfigurationif the config is not set. In other words, the generator needs the config to exist to generate the config…I don’t know why this happens to some people, when it seems to work fine for others, but I worked around the problem by manually creating the initializer and copy/paste the template:
Worked for me in Rails 6 with the same issue!
Still having this problem on a fresh install of rails 7.0.4
None of the above solutions resolve, even manually adding the initialization file does not fix. Seems like a critical bug…
This just happened to me; and the reason was because I already had the
use_doorkeeperstatement in theroutes.rb.Deleting that line fixed it 😄
Can’t reproduce the issue, so I’m closing this issue due to lack of activity. If somebody wants to reopen it - please, provide maximum information bout the env, doorkeeper initializer, Gemfile.lock and other useful data