lograge: NameError: undefined method `append_info_to_payload' for class `ActionCable::Channel::Base'

After upgraded 0.11.0.

Got a below error.

NameError: undefined method `append_info_to_payload' for class `ActionCable::Channel::Base'

with this setting

config.lograge.custom_payload do |controller|
        {
          user_agent: controller.request.user_agent,
        }
      end    

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 15
  • Comments: 15 (2 by maintainers)

Commits related to this issue

Most upvoted comments

Sorry about this folks. I’m working on a fix.

Just want to bring this one back up. Can we get #286 merged? Thanks for your work on this!

Sorry guys, that’s my fault, I did overlook the custom_payload option when implementing Action Cable log formatting. Here’s the PR with the fix: https://github.com/roidrage/lograge/pull/286 (cc @benlovell)

As for the option itself, we should figure out the way custom_payload would work in Action Cable classes. Maybe it’d be good to support formatters for each event (perform_action, subscribe, unsubscribe …) or for each class, as ActionCable::Connection::Base and ActionCable::Channel::Base don’t share a common context.

I’m getting this error as well, but only when I run the asset precompile rake task in a Docker container. The application and rake tasks work fine locally. Weird.

Adding the initializer allows me to precompile assets in the container, but I had to tweak it a little to define the config:

# frozen_string_literal: true
Rails.application.config.lograge.base_controller_class = "ActionController::Base"

It seems to work fine. I am not using ActionCable in this app.

Thanks for the tip @decoch

Ugh. I’ll get this resolved properly tomorrow. Apologies folks.

@xlts It works locally, if you could add a spec when you get a moment that would help. I’ll cut a release with the fix now.

I am also facing the same issue. Could I prevent error this but there is no problem?

# config/initializers/lograge.rb
config.lograge.base_controller_class = 'ActionController::Base'

If what I referenced above is the problematic code, it’s unchanged in 0.11.1 and I’m still getting the error.

I have the same issue. Everything works fine on v0.10.0, while I get the error on v0.11.0. I am using the latest version of Rails (v5.2.3).