-
Notifications
You must be signed in to change notification settings - Fork 289
Closed
Description
Hello all,
I'm trying to use the gem with a classic Sinatra app that's also using the Sinatra::Namespace extension. However, the gem's patching of Rack::Builder seems to be interfering with the extension and causing an ArgumentError
. I've tried disabling rack_monkey_patch
option, but it didn't help.
Here's an example app to reproduce the behavior:
# Gemfile
gem 'sinatra'
gem 'sinatra-contrib'
gem 'rollbar'
# Gemfile.lock
GEM
specs:
backports (3.6.8)
multi_json (1.12.1)
rack (1.6.8)
rack-protection (1.5.3)
rack
rack-test (0.6.3)
rack (>= 1.0)
rollbar (2.15.5)
multi_json
sinatra (1.4.7)
rack (~> 1.5)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
sinatra-contrib (1.4.7)
backports (>= 2.0)
multi_json
rack-protection
rack-test
sinatra (~> 1.4.0)
tilt (>= 1.3, < 3)
tilt (2.0.5)
PLATFORMS
ruby
DEPENDENCIES
rollbar
sinatra
sinatra-contrib
BUNDLED WITH
1.14.6
# config.ru
require './app'
run Sinatra::Application
# app.rb
require 'rollbar'
require 'sinatra'
require 'sinatra/namespace'
configure do
Rollbar.configure do |config|
config.disable_rack_monkey_patch = true
end
end
get '/' do
'hello from [index]'
end
namespace '/test' do
get do
'hello from [/test/index]'
end
end
This app works if you remove the Rollbar.configure
block - you can reach both /
and /test
routes. However, as soon as the Rollbar configuration block is added, I get an ArgumentError: wrong number of arguments (0 for 1..2)
error.
If I add a defined route to the namespace instead of a "naked" get method (that is, get /one
instead of get do
), I get a 404 at /test/one
path:
namespace '/test' do
get '/one' do
'hello from [/test/one]'
end
end