julienbourdeau / debugbar

Powerful devtools for Ruby on Rails. Inspired by the Laravel Debugbar.
https://debugbar.dev
MIT License
487 stars 8 forks source link

uninitialized constant Sprockets::Rails #17

Closed fazo96 closed 9 months ago

fazo96 commented 9 months ago

To fix #13 we are trying the 0.2 version of this gem, but we get this error:

Exiting
/usr/local/rvm/gems/ruby-3.2.2/gems/debugbar-0.2.0/lib/debugbar/engine.rb:42:in `block in <class:Engine>': uninitialized constant Sprockets::Rails (NameError)

      app.middleware.insert_after Sprockets::Rails::QuietAssets, Debugbar::QuietRoutes
                                                  ^^^^^^^^^^^^^
Did you mean?  RailsERD

So I then added sprockets-rails in our Gemfile, installed it, and then I get this error:

Exiting
/usr/local/rvm/gems/ruby-3.2.2/gems/sprockets-rails-3.4.2/lib/sprockets/railtie.rb:110:in `block in <class:Railtie>': Expected to find a manifest file in `app/assets/config/manifest.js` (Sprockets::Railtie::ManifestNeededError)
But did not, please create this file and use it to link any assets that need
to be rendered by your app:

Example:
  //= link_tree ../images
  //= link_directory ../javascripts .js
  //= link_directory ../stylesheets .css
and restart your server

For more information see: https://github.com/rails/sprockets/blob/070fc01947c111d35bb4c836e9bb71962a8e0595/UPGRADING.md#manifestjs

I don't really know what's going on or what this is, so I stopped there. Ours is an API only rails app (maybe that has something to do with this)

Looks like the bug was introduced by this commit here https://github.com/julienbourdeau/debugbar/commit/efe491bde9e0544e5fb891597bb2af47854c1169#diff-b649b89947efca18165b6c64a06e061ed7d8e13b6aebaa11421744e3ef486840R42

julienbourdeau commented 9 months ago

Thank you for the report @fazo96 and digging into it. I'll publish the fix tomorrow. I only referenced Sprocket to insert my middleware after it because it does something similar, it's not really "used". It was silly I should just insert it elsewere.

julienbourdeau commented 9 months ago

@fazo96 version 0.2.1 was published and should fix this. Please let me know if it worked for you 🙏

fazo96 commented 9 months ago

Thanks, 0.2.1 fixed it.

Unfortunately it doesn't work due to another problem but I think this one's on our end. I'll open an issue if I can get some time to investigate it

julienbourdeau commented 9 months ago

Thank you 🙏