devise-passwordless: Rails 7 compatible? Getting : uninitialized constant Devise::Mailer (NameError) Did you mean? Devise::Mailers

on Rails 7.0.0.alpha2

my Gemfile is like so:

gem 'devise' , branch: 'main' , git: 'https://github.com/heartcombo/devise.git'
gem 'devise-passwordless'

my lock file says I have devise-passwordless 0.6.1

However, when I boot the app this way (just with either rails c or rails s), there is a crash in devise-passwordless:

/Users/jason/.rvm/gems/ruby-2.7.4/gems/devise-passwordless-0.6.1/lib/devise/passwordless/mailer.rb:5:in `module:Passwordless’: uninitialized constant Devise::Mailer (NameError)

full crash here:

	61: from bin/rails:4:in `<main>'
	60: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
	59: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
	58: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
	57: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
	56: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
	55: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/railties-7.0.0.alpha2/lib/rails/commands.rb:18:in `<main>'
	54: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/railties-7.0.0.alpha2/lib/rails/command.rb:48:in `invoke'
	53: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/railties-7.0.0.alpha2/lib/rails/command/base.rb:87:in `perform'
	52: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
	51: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
	50: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
	49: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/railties-7.0.0.alpha2/lib/rails/commands/console/console_command.rb:101:in `perform'
	48: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/railties-7.0.0.alpha2/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
	47: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/railties-7.0.0.alpha2/lib/rails/command/actions.rb:28:in `require_environment!'
	46: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/railties-7.0.0.alpha2/lib/rails/application.rb:345:in `require_environment!'
	45: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/zeitwerk-2.5.1/lib/zeitwerk/kernel.rb:35:in `require'
	44: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
	43: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
	42: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
	41: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
	40: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
	39: from /Users/jason/Work/Api/my-app/config/environment.rb:5:in `<main>'
	38: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/railties-7.0.0.alpha2/lib/rails/application.rb:369:in `initialize!'
	37: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/railties-7.0.0.alpha2/lib/rails/initializable.rb:60:in `run_initializers'
	36: from /Users/jason/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/tsort.rb:205:in `tsort_each'
	35: from /Users/jason/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/tsort.rb:226:in `tsort_each'
	34: from /Users/jason/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/tsort.rb:347:in `each_strongly_connected_component'
	33: from /Users/jason/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/tsort.rb:347:in `call'
	32: from /Users/jason/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/tsort.rb:347:in `each'
	31: from /Users/jason/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/tsort.rb:349:in `block in each_strongly_connected_component'
	30: from /Users/jason/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/tsort.rb:415:in `each_strongly_connected_component_from'
	29: from /Users/jason/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/tsort.rb:415:in `call'
	28: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/railties-7.0.0.alpha2/lib/rails/initializable.rb:50:in `tsort_each_child'
	27: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/railties-7.0.0.alpha2/lib/rails/initializable.rb:50:in `each'
	26: from /Users/jason/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
	25: from /Users/jason/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/tsort.rb:431:in `each_strongly_connected_component_from'
	24: from /Users/jason/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
	23: from /Users/jason/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	22: from /Users/jason/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/tsort.rb:228:in `block in tsort_each'
	21: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/railties-7.0.0.alpha2/lib/rails/initializable.rb:61:in `block in run_initializers'
	20: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/railties-7.0.0.alpha2/lib/rails/initializable.rb:32:in `run'
	19: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/railties-7.0.0.alpha2/lib/rails/initializable.rb:32:in `instance_exec'
	18: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/railties-7.0.0.alpha2/lib/rails/engine.rb:621:in `block in <class:Engine>'
	17: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/railties-7.0.0.alpha2/lib/rails/engine.rb:621:in `each'
	16: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/railties-7.0.0.alpha2/lib/rails/engine.rb:622:in `block (2 levels) in <class:Engine>'
	15: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/railties-7.0.0.alpha2/lib/rails/engine.rb:668:in `load_config_initializer'
	14: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/activesupport-7.0.0.alpha2/lib/active_support/notifications.rb:209:in `instrument'
	13: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/railties-7.0.0.alpha2/lib/rails/engine.rb:669:in `block in load_config_initializer'
	12: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
	11: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
	10: from /Users/jason/Work/Api/my-app/config/initializers/devise.rb:11:in `<main>'
	 9: from /Users/jason/.rvm/gems/ruby-2.7.4/bundler/gems/devise-8593801130f2/lib/devise.rb:307:in `setup'
	 8: from /Users/jason/Work/Api/my-app/config/initializers/devise.rb:315:in `block in <main>'
	 7: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/zeitwerk-2.5.1/lib/zeitwerk/kernel.rb:35:in `require'
	 6: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
	 5: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
	 4: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
	 3: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
	 2: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
	 1: from /Users/jason/.rvm/gems/ruby-2.7.4/gems/devise-passwordless-0.6.1/lib/devise/passwordless/mailer.rb:3:in `<main>'
/Users/jason/.rvm/gems/ruby-2.7.4/gems/devise-passwordless-0.6.1/lib/devise/passwordless/mailer.rb:5:in `<module:Passwordless>': uninitialized constant Devise::Mailer (NameError)
Did you mean?  Devise::Mailers

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 17 (10 by maintainers)

Most upvoted comments

This should (🤞) be fixed now in master via d2921e06d77. Going to add more tests to verify before cutting a release and marking this fixed. The holdup was I wanted to figure out a way to test the gem across multiple Rails versions. It was a bit of a pain but I think I figured a solution out. Thanks all for your patience and workarounds.

Can confirm that @maribies suggestion (relocating the require statement) works for the time being.

Yes please do keep it open. I’m aware of the issue just haven’t had time to work on it yet

it does seem to be a load order issue. removing require 'devise/passwordless/mailer from the devise config and adding it to our user model seems to be a workaround for the moment.