anycable / anycable-rails

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

Cannot install on Rails 7.1 - Google::Protobuf error #202

Closed noctivityinc closed 3 weeks ago

noctivityinc commented 3 weeks ago

Tell us about your environment

ruby "3.3.4" gem "rails", "~> 7.1.3", ">= 7.1.3.4" gem "anycable-rails", "~> 1.4"

What did you do?

All I did was install anycable-rails and then tried to run setup.

What did you expect to happen?

It would work and not crash my app

What actually happened?

11:30 AM ~/Projects/wecora/seven (ac2) => rails g anycable:setup
/Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/anycable-core-1.4.3/lib/anycable/protos/rpc_pb.rb:8:in `<main>': undefined method `build' for an instance of Google::Protobuf::DescriptorPool (NoMethodError)

Google::Protobuf::DescriptorPool.generated_pool.build do
                                               ^^^^^^
        from /Users/jlippiner/.rvm/rubies/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
        from /Users/jlippiner/.rvm/rubies/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/zeitwerk-2.6.17/lib/zeitwerk/kernel.rb:34:in `require'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/anycable-core-1.4.3/lib/anycable/rpc.rb:3:in `<main>'
        from /Users/jlippiner/.rvm/rubies/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
        from /Users/jlippiner/.rvm/rubies/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/zeitwerk-2.6.17/lib/zeitwerk/kernel.rb:34:in `require'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/anycable-core-1.4.3/lib/anycable.rb:16:in `<main>'
        from /Users/jlippiner/.rvm/rubies/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
        from /Users/jlippiner/.rvm/rubies/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/zeitwerk-2.6.17/lib/zeitwerk/kernel.rb:34:in `require'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/anycable-rails-core-1.4.4/lib/anycable/rails.rb:3:in `<main>'
        from /Users/jlippiner/.rvm/rubies/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
        from /Users/jlippiner/.rvm/rubies/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/zeitwerk-2.6.17/lib/zeitwerk/kernel.rb:34:in `require'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/anycable-rails-core-1.4.4/lib/anycable-rails.rb:3:in `<main>'
        from <internal:/Users/jlippiner/.rvm/rubies/ruby-3.3.4/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from <internal:/Users/jlippiner/.rvm/rubies/ruby-3.3.4/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from /Users/jlippiner/.rvm/rubies/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/zeitwerk-2.6.17/lib/zeitwerk/kernel.rb:34:in `require'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/bundler-2.5.11/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/bundler-2.5.11/lib/bundler/runtime.rb:55:in `each'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/bundler-2.5.11/lib/bundler/runtime.rb:55:in `block in require'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/bundler-2.5.11/lib/bundler/runtime.rb:44:in `each'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/bundler-2.5.11/lib/bundler/runtime.rb:44:in `require'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/bundler-2.5.11/lib/bundler.rb:207:in `require'
        from /Users/jlippiner/Projects/wecora/seven/config/application.rb:7:in `<main>'
        from /Users/jlippiner/.rvm/rubies/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
        from /Users/jlippiner/.rvm/rubies/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/railties-7.1.3.4/lib/rails/command/actions.rb:15:in `require_application!'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/railties-7.1.3.4/lib/rails/command/actions.rb:19:in `boot_application!'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/railties-7.1.3.4/lib/rails/commands/generate/generate_command.rb:21:in `perform'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/thor-1.3.1/lib/thor/command.rb:28:in `run'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/railties-7.1.3.4/lib/rails/command/base.rb:178:in `invoke_command'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/railties-7.1.3.4/lib/rails/command/base.rb:73:in `perform'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/railties-7.1.3.4/lib/rails/command.rb:71:in `block in invoke'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/railties-7.1.3.4/lib/rails/command.rb:149:in `with_argv'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/railties-7.1.3.4/lib/rails/command.rb:69:in `invoke'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/railties-7.1.3.4/lib/rails/commands.rb:18:in `<main>'
        from /Users/jlippiner/.rvm/rubies/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
        from /Users/jlippiner/.rvm/rubies/ruby-3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
        from /Users/jlippiner/.rvm/gems/ruby-3.3.4@wecora-7/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
        from bin/rails:4:in `<main>'
palkan commented 3 weeks ago

Looks like you've upgraded the google-protobuf gem; v4 is currently not supported; adding gem "google-protobuf", "~> 3.25" should fix the issue.

Or upgrade anycable-core (and anycable) to 1.4.4 (the protobuf version requirement has been fixed there).

noctivityinc commented 3 weeks ago

Can I use any cable-core with rails? The docs say to use anycable-rails or something like that, though I cant even find that repo anymore. Where can I find the latest docs for this for Rails 7?

On Aug 19, 2024 at 10:11:19 AM, Vladimir Dementyev @.***> wrote:

Looks like you've upgraded the google-protobuf gem; v4 is currently not supported; adding gem "google-protobuf", "~> 3.25" should fix the issue.

Or upgrade anycable-core (and anycable) to 1.4.4 (the protobuf version requirement has been fixed there).

— Reply to this email directly, view it on GitHub https://github.com/anycable/anycable-rails/issues/202#issuecomment-2296678310, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAATIAUQBVY4PQGHDR45WRTZSH4IPAVCNFSM6AAAAABMVQLXHCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJWGY3TQMZRGA . You are receiving this because you authored the thread.Message ID: @.***>

palkan commented 3 weeks ago

anycable-rails depends on anycable-core

In your case, running bundle update anycable (or bundle update anycable-core) should do the trick; no need to add it explicitly to the Gemfile

noctivityinc commented 1 week ago

@palkan Ok that worked with 1.5.1 but now I get this:

anycable | ⛔️ WARNING: AnyCable RPC pool size (30) is greater than DB pool size (5)

Without any information about which database or HOW to adjust the pool sizes for either AC or the DB. Any docs here?

palkan commented 1 week ago

Without any information about which database or HOW to adjust the pool sizes for either AC or the DB.

This message says that your Active Record pool size is 5 (the default), which is less than the AnyCable gRPC worker pool size (also the default, 30). To avoid competition for DB connections, it's better to keep the in sync.

Any docs here?

https://docs.anycable.io/edge/ruby/configuration?id=concurrency-settings