Skip to content

Rack "map" functionality broken in Puma 2.12 #741

@GUI

Description

@GUI

If I have a Rails config.ru file like this:

require ::File.expand_path('../config/environment',  __FILE__)
map "/foo" do
  run Rails.application
end

After upgrading to Puma 2.12 from 2.11, I now get this error when trying to start the app:

gems/puma-2.12.1/lib/puma/rack/builder.rb:295:in `generate_map': uninitialized constant Puma::Rack::Builder::URLMap (NameError)
    from gems/2.2.0/gems/puma-2.12.1/lib/puma/rack/builder.rb:279:in `to_app'
    from config.ru:8:in `<module:PumaRackCompat>'

If I remove the map block from the config.ru file, then the error goes away. Downgrading to 2.11.3 also fixes the issue. The problem seems to be present in Puma 2.12.0 and 2.12.1.

I suspect this might be due to the removal of rack as a dependency in #705 (which is actually the primary reason I was looking to upgrade to 2.12). I saw #732 which appears like it might be a similar issue, but explicitly requiring rack doesn't seem to resolve this issue. With this config.ru I'm still getting the same errors:

require ::File.expand_path('../config/environment',  __FILE__)
require "rack"
require "rack/urlmap"
map "/foo" do
  run Rails.application
end

Is this issue perhaps different because Puma itself is trying to reference the URLMap class without requiring it?

I've encountered this in a Rails 3.2 app and a Rails 4.1 app.

Any ideas if this is solvable without breaking #705 again? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions