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

Support API-only Rails apps #203

Merged
merged 4 commits into from
Nov 15, 2024
Merged

Support API-only Rails apps #203

merged 4 commits into from
Nov 15, 2024

Conversation

rosa
Copy link
Member

@rosa rosa commented Nov 11, 2024

This is another take on #87, but without the propshaft dependency that caused a lot of problems for people using Sprockets.

@rosa rosa force-pushed the api-mode branch 2 times, most recently from 6adccae to cc7d5ed Compare November 13, 2024 09:39
Otherwise POST requests with _method set to something else won't work.
@HLFH
Copy link

HLFH commented Nov 14, 2024

Using:

gem 'mission_control-jobs', github: 'rails/mission_control-jobs', branch: 'api-mode'

Gives me this error:

bin/rails s
=> Booting Puma
=> Rails 8.0.0 application starting in development 
=> Run `bin/rails server --help` for more startup options
Exiting
/Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/railtie/configuration.rb:109:in `method_missing': undefined method `assets' for an instance of Rails::Application::Configuration (NoMethodError)
Did you mean?  asset_host
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/bundler/gems/mission_control-jobs-9d6a8b3a7902/lib/mission_control/jobs/engine.rb:90:in `block in <class:Engine>'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/initializable.rb:32:in `instance_exec'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/initializable.rb:32:in `run'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/initializable.rb:61:in `block in run_initializers'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/3.3.0/tsort.rb:231:in `block in tsort_each'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/3.3.0/tsort.rb:353:in `block (2 levels) in each_strongly_connected_component'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/3.3.0/tsort.rb:434:in `each_strongly_connected_component_from'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/3.3.0/tsort.rb:352:in `block in each_strongly_connected_component'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/3.3.0/tsort.rb:350:in `each'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/3.3.0/tsort.rb:350:in `call'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/3.3.0/tsort.rb:350:in `each_strongly_connected_component'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/3.3.0/tsort.rb:229:in `tsort_each'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/3.3.0/tsort.rb:208:in `tsort_each'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/initializable.rb:60:in `run_initializers'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/application.rb:440:in `initialize!'
        from /Users/gaspard/Documents/test/vipfishing_gateway/config/environment.rb:5:in `<main>'
        from config.ru:3:in `require_relative'
        from config.ru:3:in `block (2 levels) in <main>'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/rack-3.1.8/lib/rack/builder.rb:108:in `eval'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/rack-3.1.8/lib/rack/builder.rb:108:in `new_from_string'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/rack-3.1.8/lib/rack/builder.rb:97:in `load_file'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/rack-3.1.8/lib/rack/builder.rb:67:in `parse_file'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/rackup-2.2.1/lib/rackup/server.rb:354:in `build_app_and_options_from_config'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/rackup-2.2.1/lib/rackup/server.rb:263:in `app'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/rackup-2.2.1/lib/rackup/server.rb:424:in `wrapped_app'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/commands/server/server_command.rb:76:in `log_to_stdout'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/commands/server/server_command.rb:36:in `start'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/commands/server/server_command.rb:145:in `block in perform'
        from <internal:kernel>:90:in `tap'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/commands/server/server_command.rb:136:in `perform'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/thor-1.3.2/lib/thor/command.rb:28:in `run'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/thor-1.3.2/lib/thor/invocation.rb:127:in `invoke_command'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/command/base.rb:178:in `invoke_command'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/thor-1.3.2/lib/thor.rb:538:in `dispatch'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/command/base.rb:73:in `perform'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/command.rb:65:in `block in invoke'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/command.rb:143:in `with_argv'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/command.rb:63:in `invoke'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/commands.rb:18:in `<main>'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/3.3.0/bundled_gems.rb:75:in `require'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/3.3.0/bundled_gems.rb:75:in `block (2 levels) in replace_require'
        from /Users/gaspard/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
        from bin/rails:4:in `<main>'

Reverting to 0.3.2 but happy to try this PR again:

# Active Job dashboard
gem "mission_control-jobs", "0.3.2" # version 0.3.3 is not working with API-only mode
#gem 'mission_control-jobs', github: 'rails/mission_control-jobs', branch: 'api-mode'

@rosa
Copy link
Member Author

rosa commented Nov 14, 2024

Hey @HLFH, you'd need to add propshaft to your Gemfile as well, as instructed in the README change in this PR. I should have added to the PR description, sorry!

@HLFH
Copy link

HLFH commented Nov 15, 2024

@rosa Ok all good, awesome! Great thank you @rosa.

# Active Job dashboard
gem "mission_control-jobs", github: "rails/mission_control-jobs", branch: "api-mode"
# Deliver assets for Rails: dependency of mission_control-jobs
gem "propshaft"

This PR can be merged.

@rosa rosa merged commit 9714469 into main Nov 15, 2024
6 checks passed
@rosa rosa deleted the api-mode branch November 15, 2024 09:22
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 this pull request may close these issues.

2 participants