Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zeitwerk error under in Rails 7 / Ruby 3.1.2 #49

Closed
Azdaroth opened this issue Aug 8, 2022 · 9 comments
Closed

Zeitwerk error under in Rails 7 / Ruby 3.1.2 #49

Azdaroth opened this issue Aug 8, 2022 · 9 comments

Comments

@Azdaroth
Copy link

Azdaroth commented Aug 8, 2022

Describe the bug

When running bin/rails zeitwerk:check I'm getting:

Hold on, I am eager loading the application.
expected file /Users/azdaroth/.rvm/gems/ruby-3.1.2/gems/dry-monitor-0.6.1/lib/dry/monitor/version.rb to define constant Dry::Monitor::Version

Has anyone else experiences this issue?

My environment

  • Rails version 7.0.3.1
  • Ruby version: 3.1.2
@Azdaroth
Copy link
Author

Azdaroth commented Aug 8, 2022

The issue might be a bit more complex actually. We are using a private gem that uses dry-monitor, but also, one of the dependencies use dry-monitor as well, so there is no need to require it and having it in gemspec at all (well, of course as long as this dependency uses dry-monitor). When we removed dry-monitor from gemspec , it fixed the issue.

@solnic
Copy link
Member

solnic commented Aug 10, 2022

Thanks for reporting this. I think we need to configure zeitwerk to handle version.rb in a special way as this file defines Dry::Monitor::VERSION rather than Dry::Monitor::Version.

@flash-gordon
Copy link
Member

flash-gordon commented Aug 10, 2022

@Azdaroth I pushed 0.6.2 with a fix, please check it out

@Azdaroth
Copy link
Author

@flash-gordon Thanks for submitting a fix! Now I'm getting LoadError: cannot load such file -- rouge/util, which can be fixed by adding rouge gem to the Gemfile

@solnic
Copy link
Member

solnic commented Aug 11, 2022

uhm, this is supposed to be optional only when you want colorized SQL logging, I suspect that auto-loading is triggered in a way that ends up requiring the logging extension which depends on rouge 😞

@flash-gordon
Copy link
Member

I think we just need to opt-out extensions from autoloading, I'll take a look

@flash-gordon
Copy link
Member

I pushed 0.6.3 with a fix

@Azdaroth
Copy link
Author

@flash-gordon Thanks for the fix, everything looks fine now!

@flash-gordon
Copy link
Member

Awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants