1

I am trying to deploy a ruby on rails app on heroku so I updated my ruby version to ruby 3.0.0 and did bundle update / bundle install but it says I can not push and not even run a local development server.


=> Booting Puma
=> Rails 5.1.7 application starting in development 
=> Run `rails server -h` for more startup options
Exiting
/Users/username/.rvm/gems/ruby-3.0.0/gems/actionpack-5.1.7/lib/action_dispatch/middleware/static.rb:109:in `initialize': wrong number of arguments (given 3, expected 2) (ArgumentError)
    from /Users/username/.rvm/gems/ruby-3.0.0/gems/actionpack-5.1.7/lib/action_dispatch/middleware/stack.rb:35:in `new'
    from /Users/username/.rvm/gems/ruby-3.0.0/gems/actionpack-5.1.7/lib/action_dispatch/middleware/stack.rb:35:in `build'
    from /Users/username/.rvm/gems/ruby-3.0.0/gems/actionpack-5.1.7/lib/action_dispatch/middleware/stack.rb:99:in `block in build'
    from /Users/username/.rvm/gems/ruby-3.0.0/gems/actionpack-5.1.7/lib/action_dispatch/middleware/stack.rb:99:in `each'
    from /Users/username/.rvm/gems/ruby-3.0.0/gems/actionpack-5.1.7/lib/action_dispatch/middleware/stack.rb:99:in `inject'
    from /Users/username/.rvm/gems/ruby-3.0.0/gems/actionpack-5.1.7/lib/action_dispatch/middleware/stack.rb:99:in `build'
    from /Users/username/.rvm/gems/ruby-3.0.0/gems/railties-5.1.7/lib/rails/engine.rb:508:in `block in app'
    from /Users/username/.rvm/gems/ruby-3.0.0/gems/railties-5.1.7/lib/rails/engine.rb:504:in `synchronize'
    from /Users/username/.rvm/gems/ruby-3.0.0/gems/railties-5.1.7/lib/rails/engine.rb:504:in `app'
    from /Users/username/.rvm/gems/ruby-3.0.0/gems/railties-5.1.7/lib/rails/application/finisher.rb:45:in `block in <module:Finisher>'
    from /Users/username/.rvm/gems/ruby-3.0.0/gems/railties-5.1.7/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/username/.rvm/gems/ruby-3.0.0/gems/railties-5.1.7/lib/rails/initializable.rb:30:in `run'
    from /Users/username/.rvm/gems/ruby-3.0.0/gems/railties-5.1.7/lib/rails/initializable.rb:59:in `block in run_initializers'
    from /Users/username/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:228:in `block in tsort_each'
    from /Users/username/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from /Users/username/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:431:in `each_strongly_connected_component_from'
...

The static.rb file in question:

module ActionDispatch
...
  class Static
    def initialize(app, path, index: "index", headers: {})
      @app = app
      @file_handler = FileHandler.new(path, index: index, headers: headers)
    end

    def call(env)
      req = Rack::Request.new env

      if req.get? || req.head?
        path = req.path_info.chomp("/".freeze)
        if match = @file_handler.match?(path)
          req.path_info = match
          return @file_handler.serve(req)
        end
      end

      @app.call(req.env)
    end
  end
end

ruby version: ruby 3.0.0p0

rails version: Rails 5.1.7

gem version: 3.2.12

Can you help me out?

Dimitri
  • 25
  • 4
  • In log, it is showing the rails version as 5.1.7. But you have mentioned it as 6.1.3.? – sgk Mar 02 '21 at 07:43
  • I had both installed. I uninstalled the 6.1.3 but no change... sorry for the confusion. – Dimitri Mar 02 '21 at 08:02
  • There is already another question related to this. Please check. https://stackoverflow.com/questions/9087116/which-ruby-on-rails-is-compatible-with-which-ruby-version. Either u need to reduce your ruby version or increase the rails version. – sgk Mar 02 '21 at 08:17
  • Does this answer your question? [Which Ruby on Rails is compatible with which Ruby version?](https://stackoverflow.com/questions/9087116/which-ruby-on-rails-is-compatible-with-which-ruby-version) – Jaffa Mar 02 '21 at 08:31
  • Yes ! I updated rails by changing the gemfile with gem 'rails', '~> 6.1.3' and did bundle update and it works. Thank you ! – Dimitri Mar 02 '21 at 09:02

1 Answers1

1

ruby 2.7+ support is only available starting from rails 6, so you'll need to either downgrade ruby, or upgrade rails

Jaffa
  • 12,442
  • 4
  • 49
  • 101