Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 5 Upgrade: No such middleware to insert after: ActionDispatch::ParamsParser (RuntimeError)

I am upgrading an app from Rails 4.2 to Rails 5 beta1.1 in development. App worked well before upgrade. I have gone through the basic upgrade steps (updating Ruby, updating Rails, and related steps at:http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html). Gemfile has also been updated to latest Gems.

When I run $ rails middleware or $ rails console or $ rails server I get the following error:

No such middleware to insert after: ActionDispatch::ParamsParser
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/actionpack/lib/action_dispatch/middleware/stack.rb:108:in `assert_index'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/actionpack/lib/action_dispatch/middleware/stack.rb:80:in `insert_after'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/configuration.rb:69:in `block in merge_into'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/configuration.rb:68:in `each'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/configuration.rb:68:in `merge_into'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/engine.rb:507:in `block in app'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/engine.rb:504:in `synchronize'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/engine.rb:504:in `app'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/application/finisher.rb:34:in `block in <module:Finisher>'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/initializable.rb:30:in `instance_exec'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/initializable.rb:30:in `run'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/initializable.rb:55:in `block in run_initializers'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/initializable.rb:54:in `run_initializers'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/application.rb:350:in `initialize!'
.../config/environment.rb:5:in `<top (required)>'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/activesupport/lib/active_support/dependencies.rb:302:in `require'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/activesupport/lib/active_support/dependencies.rb:302:in `block in require'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/activesupport/lib/active_support/dependencies.rb:268:in `load_dependency'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/activesupport/lib/active_support/dependencies.rb:302:in `require'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/application.rb:326:in `require_environment!'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/application.rb:446:in `block in run_tasks_blocks'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/commands/rake_proxy.rb:13:in `block in run_rake_task'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/commands/rake_proxy.rb:10:in `run_rake_task'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/commands/commands_tasks.rb:51:in `run_command!'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/command.rb:20:in `run'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/commands.rb:19:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'

This is related to fact that ActionDispatch::ParamsParser has been removed from Rails 5 beta middleware (https://github.com/rails/rails/commit/38d2bf5fd1f3e014f2397898d371c339baa627b1). But, in someway my app still seems to be looking for it.

I have tried various things with ActionDispatch::ParamsParser in config/application.rb, such as deleting it, and, when that didn't work, I also tried adding it. Same error. Any way to get past this error?

like image 222
TH1J2 Avatar asked Feb 02 '16 22:02

TH1J2


1 Answers

I believe this error was caused by a gem that has not been updated yet for Rails 5. I had been using the gem remotipart (https://github.com/JangoSteve/remotipart). It has been very helpful. When I remove it from the gem file, the error noted in the question goes away.

like image 174
TH1J2 Avatar answered Oct 17 '22 01:10

TH1J2