solidusio / solidus_auth_devise

🔑 Devise authentication for your Solidus store.
http://solidus.io
BSD 3-Clause "New" or "Revised" License
53 stars 128 forks source link

Bug: NameError #174

Closed skukx closed 4 years ago

skukx commented 4 years ago

rails version : 6.0.0

solidus Version: 2.10.0.beta1

solidus_auth_devise Version: 2.3.0

Running RAILS_ENV=production bundle exec rails s results in the following error with a fresh install of solidus. It could be something I've misconfigured so please let me know

NameError: expected file /usr/local/bundle/gems/solidus_auth_devise-2.3.0/app/overrides/auth_shared_login_bar.rb to define constant AuthSharedLoginBar, but didn't
bundler: failed to load command: puma (/usr/local/bundle/bin/puma)
NameError: expected file /usr/local/bundle/gems/solidus_auth_devise-2.3.0/app/overrides/auth_shared_login_bar.rb to define constant AuthSharedLoginBar, but didn't
  /usr/local/bundle/gems/zeitwerk-2.1.10/lib/zeitwerk/loader/callbacks.rb:17:in `on_file_autoloaded'
  /usr/local/bundle/gems/zeitwerk-2.1.10/lib/zeitwerk/kernel.rb:17:in `block in require'
  /usr/local/bundle/gems/zeitwerk-2.1.10/lib/zeitwerk/kernel.rb:16:in `tap'
  /usr/local/bundle/gems/zeitwerk-2.1.10/lib/zeitwerk/kernel.rb:16:in `require'
  /usr/local/bundle/gems/zeitwerk-2.1.10/lib/zeitwerk/loader.rb:351:in `const_get'
  /usr/local/bundle/gems/zeitwerk-2.1.10/lib/zeitwerk/loader.rb:351:in `block (2 levels) in eager_load'
  /usr/local/bundle/gems/zeitwerk-2.1.10/lib/zeitwerk/loader.rb:679:in `block in ls'
  /usr/local/bundle/gems/zeitwerk-2.1.10/lib/zeitwerk/loader.rb:676:in `foreach'
  /usr/local/bundle/gems/zeitwerk-2.1.10/lib/zeitwerk/loader.rb:676:in `ls'
  /usr/local/bundle/gems/zeitwerk-2.1.10/lib/zeitwerk/loader.rb:346:in `block in eager_load'
  /usr/local/bundle/gems/zeitwerk-2.1.10/lib/zeitwerk/loader.rb:338:in `synchronize'
  /usr/local/bundle/gems/zeitwerk-2.1.10/lib/zeitwerk/loader.rb:338:in `eager_load'
  /usr/local/bundle/gems/zeitwerk-2.1.10/lib/zeitwerk/loader.rb:449:in `each'
  /usr/local/bundle/gems/zeitwerk-2.1.10/lib/zeitwerk/loader.rb:449:in `eager_load_all'
  /usr/local/bundle/gems/railties-6.0.0/lib/rails/application/finisher.rb:122:in `block in <module:Finisher>'
  /usr/local/bundle/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `instance_exec'
  /usr/local/bundle/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `run'
  /usr/local/bundle/gems/railties-6.0.0/lib/rails/initializable.rb:61:in `block in run_initializers'
  /usr/local/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
  /usr/local/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
  /usr/local/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
  /usr/local/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
  /usr/local/lib/ruby/2.6.0/tsort.rb:347:in `each'
  /usr/local/lib/ruby/2.6.0/tsort.rb:347:in `call'
  /usr/local/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
  /usr/local/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
  /usr/local/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
  /usr/local/bundle/gems/railties-6.0.0/lib/rails/initializable.rb:60:in `run_initializers'
  /usr/local/bundle/gems/railties-6.0.0/lib/rails/application.rb:363:in `initialize!'
  /app/config/environment.rb:5:in `<top (required)>'
  config.ru:3:in `require_relative'
  config.ru:3:in `block in <main>'
  /usr/local/bundle/gems/rack-2.0.7/lib/rack/builder.rb:55:in `instance_eval'
  /usr/local/bundle/gems/rack-2.0.7/lib/rack/builder.rb:55:in `initialize'
  config.ru:in `new'
  config.ru:in `<main>'
  /usr/local/bundle/gems/rack-2.0.7/lib/rack/builder.rb:49:in `eval'
  /usr/local/bundle/gems/rack-2.0.7/lib/rack/builder.rb:49:in `new_from_string'
  /usr/local/bundle/gems/rack-2.0.7/lib/rack/builder.rb:40:in `parse_file'
  /usr/local/bundle/gems/puma-3.12.1/lib/puma/configuration.rb:320:in `load_rackup'
  /usr/local/bundle/gems/puma-3.12.1/lib/puma/configuration.rb:245:in `app'
  /usr/local/bundle/gems/puma-3.12.1/lib/puma/runner.rb:147:in `load_and_bind'
  /usr/local/bundle/gems/puma-3.12.1/lib/puma/single.rb:98:in `run'
  /usr/local/bundle/gems/puma-3.12.1/lib/puma/launcher.rb:186:in `run'
  /usr/local/bundle/gems/puma-3.12.1/lib/puma/cli.rb:80:in `run'
  /usr/local/bundle/gems/puma-3.12.1/bin/puma:10:in `<top (required)>'
  /usr/local/bundle/bin/puma:23:in `load'
  /usr/local/bundle/bin/puma:23:in `<top (required)>'
skukx commented 4 years ago

I believe this is due to how rails 6 now eager loads:

See: https://github.com/fxn/zeitwerk#use-case-files-that-do-not-follow-the-conventions

skukx commented 4 years ago

You can opt-out of using zeitwerk autoloader in the meantime by adding this:

# https://guides.rubyonrails.org/autoloading_and_reloading_constants.html#opting-out

# config/application.rb
config.load_defaults "6.0"
config.autoloader = :classic
kennyadsl commented 4 years ago

Thanks, we need to update some file content to be compatible with Zeitwerk. I'll take care of this as soon as possible.

kennyadsl commented 4 years ago

I merged #176 and we can close this one when a new version will be released.

kennyadsl commented 4 years ago

The fix for this is included into versions 2.4.0