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

Production rails server does not boot if skipping action cable in Rails 8.0.0.alpha #51860

Closed
jeromedalbert opened this issue May 18, 2024 · 2 comments
Labels

Comments

@jeromedalbert
Copy link
Contributor

jeromedalbert commented May 18, 2024

Steps to reproduce

rails new myapp --main --skip-action-cable
RAILS_ENV=production rails server

or

rails new myapp --main --skip-action-cable
sed -i -e 's/eager_load = false/eager_load = true/' config/environments/development.rb
rails server

Expected behavior

Server boots.

Actual behavior

Server does not boot and errors out:

=> Booting Puma
=> Rails 8.0.0.alpha application starting in development
=> Run `bin/rails server --help` for more startup options
Exiting
/Users/jerome/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/turbo-rails-2.0.5/app/channels/turbo/streams_channel.rb:34:in `<main>': uninitialized constant ActionCable (NameError)

class Turbo::StreamsChannel < ActionCable::Channel::Base
                              ^^^^^^^^^^^

System configuration

Rails version: 8.0.0.alpha

Ruby version: 3.3.1

Additional information

Rails 8 has the Turbo gem included by default. But Turbo Streams depends on Action Cable. When using --skip-action-cable, the line require "action_cable/engine" is commented out in config/application.rb, which makes Turbo error out. A current workaround is to uncomment that line manually.

Some ideas for a solution:

  1. I am not familiar with Turbo, but maybe edit the gem to disable Turbo Streams if Action Cable is not defined
  2. Exclude turbo-rails when --skip-action-cable is supplied (suggested by @dbelling in #51768)
  3. Ignore --skip-action-cable unless a new --skip-turbo option is supplied (to be implemented, this option does not currently exist)
  4. Remove the --skip-action-cable option altogether, which seems too drastic
  5. Any other idea
@justinko
Copy link
Contributor

I vote for 3, but instead of ignoring, raise an error stating turbo must be skipped as well.

@zzak
Copy link
Member

zzak commented May 20, 2024

We do not need two issues for the same bug, thank you for reporting.

@zzak zzak closed this as completed May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants