Closed obromios closed 7 months ago
I've encountered a similar error with the adapter_name
method. It occurs when I send a deliver_later
email, with the traceback only showing in the controller where I invoke the email sending. My project is running on Rails 7.0.4 with Sidekiq as the queue adapter.
undefined method adapter_name for ActiveJob.adapter_name(event.payload[:adapter])
Upon reviewing the gems, I've pinpointed the issue within the private methods of lib/debugbar/subscribers/active_job.rb
.
def queue_name(event)
ActiveJob.adapter_name(event.payload[:adapter]) + "(#{event.payload[:job].queue_name})"
end
I couldn't find anything about ActiveJob#adapter_name
despite checking the Rails docs and the internet. So, I tried changing it like this.
def queue_name(event)
"(#{event.payload[:job].queue_name})"
end
Maybe it's a bit risky to avoid the error this way (at least until the new fixes). You could simply disable the feature in the initializer instead.
Debugbar.configure do |config|
config.active_job = false
end
Thank you @obromios for the report and @raihanM99 for digging! 🙏
The queue_name method was directly copied from Rails but I didn't realize that ActiveJob.adapter_name
was only added recently!
I have started a fix that I'm hoping to publish this week: https://github.com/julienbourdeau/debugbar/pull/24
Thank you for fixing this. I tried to test it with the master branch, but saw an exception with this explanation
debugbar_javascript was removed in 0.3.0.
Please use `debugbar_head` inside <head> and `debugbar_body(opt_hash)` at the end of <body> instead.
It was split to support Turbo Drive.
See https://debugbar.dev/changelog/ for more information.
I tried putting it <%= debugbar_body(opt_hash) %> into the body, but opt_hash in not defined. Maybe it is now a configuration option? I checked the changelog and it did not contain any more information and the current documentation has not been updated for the Turbo drive release. I apologise if you were planning to fix this for the next gem release.
I also note that the documentation for the action cable configuration has Algolia::Application.configure
whereas I was expecting to see Rails.application.configure
for development.rb
Thank you for testing so fast @obromios 😄 I have released 0.3.0 and updated the docs. The error message was meant to say "this is where you put your config if you have any" but you're right it wasn't clear. I updated the error message before the release 🙏
You can use debugbar_body
alone or pass it some config hash debugbar_body height: 740
.
The documentation was fully updated!
I also removed the mention of Algolia
instead of Rails
. At the time, I was working at Algolia and copy pasted the config from the app 😄
I have tried 0.3.0 and the documentation is up to date, and it all works well. Thank you for this useful utility.
This looks like a very good idea, however, when I install it according to the instructions I get the following exception on page load
and the exception occurs at this line in a before_action in my application controller
EventTrackingJob.perform_later(name: "Visited #{controller_name}##{action_name}", user_id: visitor_id)