Rails 7.1.2 upgrade, Rack::Handler deprecation warning

We’re on 7.0.8, and I’m trying to upgrade to 7.1.2. When I run rspec, I get a bunch of these warnings:

Rack::Handler is deprecated and replaced by Rackup::Handler

What am I doing wrong? How can I make this go away?

We’re on puma (6.4.0), rack (3.0.8), rackup (2.1.0), railties (7.1.2)

Thanks!

I go this same error. The error is emitted by the rackup gem if using the older Rack::Server class instead of the renamed Rackup::Server class. This was part of Rack doing a bit of re-org and splitting off the rackup gem. See the upgrade guide for more info.

For me the source was an extension to the Rack::Server by rails_semantic_logger. For you it might be some other gem. How I found this was:

  1. Run bundle info rackup to find where rackup is installed
  2. At that location edit the lib/rack/server.rb file by putting warn caller prior to the warn line.
  3. Run the application. Where you previously just got the warning you now get a whole backtrace making it easy to see who is referencing Rack::Server instead of Rackup::Server.
  4. Follow up with the offending gem with a PR to help us all. :slight_smile: (still on my todo list for rails_semantic_logger)
  5. Don’t forget to remove puts caller from your installation of the rackup gem.

In my case this was caused by capybara/registrations/server.rb. It does not appear to be a major issue at the moment since Rackup redirects the request to Rackup::Handler. I wonder how long that will last?