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

Fix deprecation warning when booting puma using rack 3 #2706

Conversation

mattbrictson
Copy link
Contributor

Before, using capybara on a project with rack 3 would emit the following warning:

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

This was because the capybara server registration code for :puma was referencing the deprecated Rack::Handler::Puma constant.

Fix by detecting and preferring the Rackup::Handler::Puma constant, if present.

Fixes #2705

Before, using capybara on a project with rack 3 would emit the following
warning:

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

This was because the capybara server registration code for `:puma` was
referencing the deprecated `Rack::Handler::Puma` constant.

Fix by detecting and preferring the `Rackup::Handler::Puma` constant,
if present.

Fixes teamcapybara#2705
@twalpole twalpole merged commit 49e3faf into teamcapybara:master Oct 8, 2023
@mattbrictson mattbrictson deleted the bugs/fix-puma-rack-3-deprecation-warning branch October 8, 2023 21:30
lukeify pushed a commit to ackama/rails-template that referenced this pull request Nov 16, 2023
Resolves #500 

This aims to be the minimal changes required for the template to work
with Rails 7.1

### Things which are not in scope for this PR

* Rails now generates docker related files - I've forced/skipped those
because their docker is focused on production and the diff is quite
large so I think it's best to tackle that as its own separate thing

### TODO
- [x] Do the basic upgrade
- [x] Adjust `frontend-base` to account for Shakapacker now doing a
thing we previously did ourselves.
- [x] `Rack::Handler is deprecated and replaced by Rackup::Handler`
warning. This appears during system tests. It is a knownw [Capybara
issue which is fixed but waiting on a gem
release](teamcapybara/capybara#2706). Since this
is just a warning and will go away in due course, we can ignore it.
- [x] Resolve `Setting 'useContentHash' to 'false' in the production
environment (specified by NODE_ENV environment variable) is not allowed!
Content hashes get added to the filenames regardless of setting
useContentHash in 'shakapacker.yml' to false.` warning. This warning
seems to caused by the default `shakapacker.yml`. Shakapacker generates
a `shakapacker.yml` file where `useContentHash: false` is set in the
`&default` section and then `useContentHash: true` is explicitly set in
the production section. It doesn't seem like a real problem so I think
we can ignore this.
- [x] Make a decision about #507 and implement it here 
    - We have decided to leave this option commented out for now.
- [ ] Make a decision about how to handle the
`Rails.application.secrets` deprecation because it will be removed in
7.2. #341 has good
context on the last time we discussed this.

---------

Co-authored-by: Eoin Kelly <eoin@eoinkelly.info>
Co-authored-by: Eoin Kelly <eoin.kelly@ackama.com>
@gstokkink
Copy link

@twalpole could we get a new release with this fix please?

@dorianmarie
Copy link

A release would be nice <3 https://discuss.rubyonrails.org/t/rails-7-1-2-upgrade-rack-handler-deprecation-warning/84166/6

@drsharp
Copy link

drsharp commented Jan 21, 2024

I've temporarily adopted Matt's quick patch (in my helper class for system tests) until this is officially released. https://discuss.rubyonrails.org/t/rails-7-1-2-upgrade-rack-handler-deprecation-warning/84166/4

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.

Rack::Handler is deprecated warning when using Rails 7.1 beta and Rack 3
5 participants