anycable / anycable-rails

AnyCable for Ruby on Rails applications
https://anycable.io
MIT License
495 stars 35 forks source link

ActiveSupport::Logger.broadcast method is dropped #188

Closed kalashnikovisme closed 11 months ago

kalashnikovisme commented 11 months ago

Ruby version: Ruby 3.2.2

Rails version: 7.1.0.rc1

anycable gem version: 1.4.2

anycable-rails gem version: 1.4.0

grpc gem version: 1.58.0-x86_64-linux

What did you do?

Tried to run my application with new Rails 7.1.0.rc1

What did you expect to happen?

Everything should work as before Rails upgrade.

What actually happened?

Got this error

ecwidai-anycable-1  | undefined method `broadcast' for ActiveSupport::Logger:Class
ecwidai-anycable-1  | /usr/local/bundle/gems/anycable-rails-1.4.0/lib/anycable/rails/railtie.rb:31:in `block (2 levels) in <class:Railtie>'
ecwidai-anycable-1  | /usr/local/bundle/gems/anycable-core-1.4.1/lib/anycable/cli.rb:175:in `each'
ecwidai-anycable-1  | /usr/local/bundle/gems/anycable-core-1.4.1/lib/anycable/cli.rb:175:in `configure_server!'
ecwidai-anycable-1  | /usr/local/bundle/gems/anycable-core-1.4.1/lib/anycable/cli.rb:52:in `run'
ecwidai-anycable-1  | /usr/local/bundle/gems/anycable-core-1.4.1/bin/anycable:7:in `<top (required)>'
ecwidai-anycable-1  | /usr/local/bundle/bin/anycable:25:in `load'
ecwidai-anycable-1  | /usr/local/bundle/bin/anycable:25:in `<top (required)>'

According to this commit in Rails repo, ActiveSupport::Logger.broadcast method is dropped.

Sidekiq has the same issue. So, it was fixed here.

I've implemented something like this in my fork. Look at this. Looks like everything works. I'm testing it right now.

Didn't submit a PR cause I don't know how you manage Rails versions differences :slightly_smiling_face:

palkan commented 11 months ago

Thanks!

Fixed and released in 1.4.1

MBM1607 commented 9 months ago

@palkan I am experiencing the same error even though I am using the latest version.

Ruby version: 3.2.2
Rails version: 7.1.2
anycable Gem Version: 1.4.3
anycable-rails Gem Version: 1.4.2
palkan commented 9 months ago

Hey @MBM1607

Could you please share a stack trace?

MBM1607 commented 9 months ago

Yes, sure. Sorry, I should have included it with the original message.

Error

anycable | undefined method `broadcast' for ActiveSupport::Logger:Class
anycable | /home/muhammad/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/anycable-rails-core-1.4.2/lib/anycable/rails/railtie.rb:37:in `block (2 levels) in <class:Railtie>'
anycable | /home/muhammad/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/anycable-core-1.4.3/lib/anycable/cli.rb:175:in `each'
anycable | /home/muhammad/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/anycable-core-1.4.3/lib/anycable/cli.rb:175:in `configure_server!'
anycable | /home/muhammad/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/anycable-core-1.4.3/lib/anycable/cli.rb:52:in `run'
anycable | /home/muhammad/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/anycable-core-1.4.3/bin/anycable:7:in `<top (required)>'
anycable | /home/muhammad/.rbenv/versions/3.2.2/bin/anycable:25:in `load'
anycable | /home/muhammad/.rbenv/versions/3.2.2/bin/anycable:25:in `<top (required)>'
anycable | /home/muhammad/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/cli/exec.rb:58:in `load'
anycable | /home/muhammad/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/cli/exec.rb:58:in `kernel_load'
anycable | /home/muhammad/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/cli/exec.rb:23:in `run'
anycable | /home/muhammad/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/cli.rb:492:in `exec'
palkan commented 9 months ago

@MBM1607 Thanks! How do you configure your logger? I guess, you're not using the default one. I pushed a fix to master, could you please check it?

MBM1607 commented 9 months ago

@palkan The logger is the default one, but I am using overmind to run several processes at once, which is why the stack trace looks different.

Let me try with your latest fix, I will get back to you.

MBM1607 commented 9 months ago

@palkan It is working flawlessly with the latest fix.

palkan commented 9 months ago

Thanks! Released in 1.4.3