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

NameError: undefined method append_info_to_payload' for class ActionCable::Channel::Base' #285

Closed
kntmrkm opened this issue Apr 17, 2019 · 15 comments · Fixed by #286
Closed

Comments

@kntmrkm
Copy link

kntmrkm commented Apr 17, 2019

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    
@decoch
Copy link

decoch commented Apr 17, 2019

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'

@barrettclark
Copy link

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

@benlovell
Copy link
Collaborator

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

@collimarco
Copy link

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).

xlts added a commit to xlts/lograge that referenced this issue Apr 18, 2019
…om_payload

Remove ActionCable::Channel::Base from base classes when setting custom_payload

Fixes roidrage#285
@xlts
Copy link
Contributor

xlts commented Apr 18, 2019

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: #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.

xlts added a commit to xlts/lograge that referenced this issue Apr 19, 2019
…om_payload

Remove ActionCable::Channel::Base from base classes when setting custom_payload

Fixes roidrage#285
xlts added a commit to xlts/lograge that referenced this issue Apr 19, 2019
…om_payload

Remove ActionCable::Channel::Base from base classes when setting custom_payload

Fixes roidrage#285
CHTJonas added a commit to CHTJonas/roombooking that referenced this issue Apr 21, 2019
This reverts commit 1907376 pending
the resolution of roidrage/lograge#285.
@billdueber
Copy link

I still see this under 0.11.0 -- a quick look shows the code in the 0.11.0 tag doesn't have the fix from #286 in it (see

lograge/lib/lograge.rb

Lines 169 to 172 in 244ce40

if base_classes.empty?
base_classes << ActionController::Base
base_classes << ActionCable::Channel::Base if defined?(ActionCable)
end
). Are you planning a release that includes it?

@benlovell
Copy link
Collaborator

I've just released 0.11.1 including this fix.

@billdueber
Copy link

billdueber commented May 17, 2019

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

@CHTJonas
Copy link

Likewise error is still occurring here 😢 This needs to be reopened @benlovell.

@benlovell
Copy link
Collaborator

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

@benlovell benlovell reopened this May 17, 2019
@billdueber
Copy link

Hey, it's open source on a Friday afternoon. Don't apologize too hard 😄

@benbartling
Copy link

benbartling commented Jun 8, 2019

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

@xlts
Copy link
Contributor

xlts commented Jun 12, 2019

@benlovell please let us know if there's anything preventing #286 from being merged 🙂

@benlovell
Copy link
Collaborator

I'm not 100% convinced this resolves the issue. It has no test that verifies the behaviour so I have to set up a project myself to verify it manually and I'm reluctant to do this as something previously touted as a fix was not. If someone adds a spec for it I'll merge it right away. I've just not had the bandwidth to take care of it myself :(

benlovell pushed a commit that referenced this issue Jun 12, 2019
…om_payload (#286)

Remove ActionCable::Channel::Base from base classes when setting custom_payload

Fixes #285
@benlovell
Copy link
Collaborator

@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.

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

Successfully merging a pull request may close this issue.

9 participants