Open ExperienciasPeru opened 2 years ago
@ExperienciasPeru Could you please check with gem from github, from master branch?
@mlitwiniuk Just did it, results attached.
Using lit 1.1.6 from https://github.com/prograils/lit (at master@dc11ab3)
rails aborted! NameError: uninitialized constant Lit::Locale Lit::Locale.table_exists? ^^^^^^^^ /var/www/r3r7/dev/config/initializers/lit.rb:62:in `<main>' /var/www/r3r7/dev/config/environment.rb:5:in `<main>' Tasks: TOP => db:migrate => db:load_config => environment (See full trace by running task with --trace)
** Invoke zeitwerk:check (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute zeitwerk:check
Hold on, I am eager loading the application.
WARNING: The following directories will only be checked if you configure
them to be eager loaded:
/home/webmaster/.rvm/gems/ruby-3.1.2/bundler/gems/lit-dc11ab341552/app/controllers/lit/concerns
You may verify them manually, or add them to config.eager_load_paths
in config/application.rb and run zeitwerk:check again.
Otherwise, all is good!
** Invoke zeitwerk:check (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute zeitwerk:check
Hold on, I am eager loading the application.
rails aborted!
NameError: uninitialized constant Lit::RequestKeysStore
include Lit::RequestKeysStore
^^^^^^^^^^^^^^^^^^
Did you mean? RequestInfoStore
/var/www/r3r7/dev/app/controllers/application_controller.rb:7:in `<class:ApplicationController>'
/var/www/r3r7/dev/app/controllers/application_controller.rb:1:in `<main>'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:27:in `require'
/var/www/r3r7/dev/app/controllers/admin_controller.rb:1:in `<main>'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:27:in `require'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:127:in `const_get'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:127:in `cget'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/loader.rb:239:in `block (2 levels) in eager_load'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:41:in `block in ls'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:27:in `each'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:27:in `ls'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/loader.rb:234:in `block in eager_load'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/loader.rb:219:in `synchronize'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/loader.rb:219:in `eager_load'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/loader.rb:318:in `each'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/loader.rb:318:in `eager_load_all'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/railties-7.0.3.1/lib/rails/tasks/zeitwerk.rake:5:in `block in <main>'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/railties-7.0.3.1/lib/rails/tasks/zeitwerk.rake:39:in `block (2 levels) in <main>'
/home/webmaster/.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/home/webmaster/.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/home/webmaster/.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/home/webmaster/.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/home/webmaster/.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/home/webmaster/.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/home/webmaster/.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/home/webmaster/.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'/home/webmaster/.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/home/webmaster/.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/home/webmaster/.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/home/webmaster/.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/home/webmaster/.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/railties-7.0.3.1/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/home/webmaster/.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/railties-7.0.3.1/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/home/webmaster/.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_module.rb:59:in `with_application'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/railties-7.0.3.1/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/railties-7.0.3.1/lib/rails/command.rb:51:in `invoke'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/railties-7.0.3.1/lib/rails/commands.rb:18:in `<main>'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/home/webmaster/.rvm/gems/ruby-3.1.2/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => zeitwerk:check
Hey, could this error be related to this deprecation warning I get:
DEPRECATION WARNING: Initialization autoloaded the constants Lit::Base, Lit::Locale, Lit::Localization, and Lit::LocalizationKey.
Being able to do this is deprecated. Autoloading during initialization is going
to be an error condition in future versions of Rails.
Reloading does not reboot the application, and therefore code executed during
initialization does not run again. So, if you reload Lit::Base, for example,
the expected changes won't be reflected in that stale Class object.
These autoloaded constants have been unloaded.
In order to autoload safely at boot time, please wrap your code in a reloader
callback this way:
Rails.application.reloader.to_prepare do
# Autoload classes and modules needed at boot time here.
end
That block runs when the application boots, and every time there is a reload.
For historical reasons, it may run twice, so it has to be idempotent.
What do you think?
I had the same issue and adding to_prepare
block should help:
# Initialize lit
if Rails.env.staging? || Rails.env.production?
Rails.application.reloader.to_prepare do
Lit.init
end
end
Regards.
Currently I'm on a migration process, but I cannot find myself a way through the current problem, somehow Lit works perfectly with redis on my 'local' environment (literal clone from 'development'), but when I run it from the Development server, it just simply break because Zeitwerk cannot load the controller concerns (output below).
First I want to list exactly what changes I've made and the environment details:
About the server environment ('local' too):
Now, I like to always try a fresh install before making a ticket, if this is irrelevant, please move down to the 'Now my case' section.
/.rvm/gems/ruby-3.1.2/gems/lit-1.1.6/lib/lit.rb:56:in
check_if_table_exists' /.rvm/gems/ruby-3.1.2/gems/lit-1.1.6/lib/lit.rb:29:in
init' /lit_test/config/initializers/lit.rb:62:in<main>' /.rvm/gems/ruby-3.1.2/gems/railties-7.0.4/lib/rails/engine.rb:667:in
load' /.rvm/gems/ruby-3.1.2/gems/railties-7.0.4/lib/rails/engine.rb:667:in `block in load_config_initializer' [...]Invoke zeitwerk:check (first_time) Invoke environment (first_time) Execute environment Execute zeitwerk:check Hold on, I am eager loading the application. rails aborted! NameError: uninitialized constant Lit::Concerns
module Lit::Concerns::RequestInfoStore ^^^^^^^^^^ Did you mean? Concurrent /.rvm/gems/ruby-3.1.2/gems/lit-1.1.6/app/controllers/lit/concerns/request_info_store.rb:1:in'
/.rvm/gems/ruby-3.1.2/gems/railties-7.0.4/lib/rails/tasks/zeitwerk.rake:39:in '
Tasks: TOP => zeitwerk:check
<main>' /.rvm/gems/ruby-3.1.2/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in
require' /.rvm/gems/ruby-3.1.2/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:inrequire' /.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:27:in
require' /.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:127:inconst_get' /.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:127:in
cget' /.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/loader.rb:239:inblock (2 levels) in eager_load' /.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:41:in
block in ls' /.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:27:ineach' /.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:27:in
ls' /.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/loader.rb:234:inblock in eager_load' /.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/loader.rb:219:in
synchronize' /.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/loader.rb:219:ineager_load' /.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/loader.rb:318:in
each' /.rvm/gems/ruby-3.1.2/gems/zeitwerk-2.6.0/lib/zeitwerk/loader.rb:318:ineager_load_all' /.rvm/gems/ruby-3.1.2/gems/railties-7.0.4/lib/rails/tasks/zeitwerk.rake:5:in
block inblock (2 levels) in <main>' /.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in
block in execute' /.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:ineach' /.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in
execute' /.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:219:inblock in invoke_with_call_chain' /.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in
synchronize' /.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:ininvoke_with_call_chain' /.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:188:in
invoke' /.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:160:ininvoke_task' /.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in
block (2 levels) in top_level' /.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:ineach' /.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in
block in top_level' /.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:125:inrun_with_threads' /.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:110:in
top_level' /.rvm/gems/ruby-3.1.2/gems/railties-7.0.4/lib/rails/commands/rake/rake_command.rb:24:inblock (2 levels) in perform' /.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:186:in
standard_exception_handling' /.rvm/gems/ruby-3.1.2/gems/railties-7.0.4/lib/rails/commands/rake/rake_command.rb:24:inblock in perform' /.rvm/rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_module.rb:59:in
with_application' /.rvm/gems/ruby-3.1.2/gems/railties-7.0.4/lib/rails/commands/rake/rake_command.rb:18:inperform' /.rvm/gems/ruby-3.1.2/gems/railties-7.0.4/lib/rails/command.rb:51:in
invoke' /.rvm/gems/ruby-3.1.2/gems/railties-7.0.4/lib/rails/commands.rb:18:in<main>' /.rvm/gems/ruby-3.1.2/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in
require' /.rvm/gems/ruby-3.1.2/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:inrequire' bin/rails:4:in
uninitialized constant Lit::Locale