railsware / rack_session_access

Rack middleware that provides access to rack.session environment
MIT License
257 stars 29 forks source link

undefined method `new' for RackSessionAccess:Module #32

Closed cyclingzealot closed 5 years ago

cyclingzealot commented 5 years ago

After initializing sessions in my main Sinatra application:

 26 enable :sessions
 27 set :session_secret, [...]
 28 set :session_expire, 30*60 #30 minutes
 29 set :session_name, '[...]'
 30 set :session_path, '/'
 31 use RackSessionAccess

I get this when going to /:

Puma caught this error: undefined method `new' for RackSessionAccess:Module (NoMethodError)
/usr/local/rvm/gems/ruby-2.3.1/gems/rack-2.0.6/lib/rack/builder.rb:86:in `block in use'
/usr/local/rvm/gems/ruby-2.3.1/gems/rack-2.0.6/lib/rack/builder.rb:147:in `block in to_app'
/usr/local/rvm/gems/ruby-2.3.1/gems/rack-2.0.6/lib/rack/builder.rb:147:in `each'
/usr/local/rvm/gems/ruby-2.3.1/gems/rack-2.0.6/lib/rack/builder.rb:147:in `inject'
/usr/local/rvm/gems/ruby-2.3.1/gems/rack-2.0.6/lib/rack/builder.rb:147:in `to_app'
/usr/local/rvm/gems/ruby-2.3.1/gems/sinatra-2.0.5/lib/sinatra/base.rb:1488:in `new'
/usr/local/rvm/gems/ruby-2.3.1/gems/sinatra-2.0.5/lib/sinatra/base.rb:1477:in `prototype'
/usr/local/rvm/gems/ruby-2.3.1/gems/sinatra-2.0.5/lib/sinatra/base.rb:1502:in `block in call'
/usr/local/rvm/gems/ruby-2.3.1/gems/sinatra-2.0.5/lib/sinatra/base.rb:1729:in `synchronize'
/usr/local/rvm/gems/ruby-2.3.1/gems/sinatra-2.0.5/lib/sinatra/base.rb:1502:in `call'
/usr/local/rvm/gems/ruby-2.3.1/gems/puma-3.12.0/lib/puma/configuration.rb:225:in `call'
/usr/local/rvm/gems/ruby-2.3.1/gems/puma-3.12.0/lib/puma/server.rb:658:in `handle_request'
/usr/local/rvm/gems/ruby-2.3.1/gems/puma-3.12.0/lib/puma/server.rb:472:in `process_client'
/usr/local/rvm/gems/ruby-2.3.1/gems/puma-3.12.0/lib/puma/server.rb:332:in `block in run'
/usr/local/rvm/gems/ruby-2.3.1/gems/puma-3.12.0/lib/puma/thread_pool.rb:133:in `block in spawn_thread'

Using version 0.2.0 of the gem.

rickpastoor commented 5 years ago

Same here.

ayanko commented 5 years ago

Ok. Will check later... Sinatra version?

On Tue, Feb 26, 2019, 21:55 Rick Pastoor notifications@github.com wrote:

Same here.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/railsware/rack_session_access/issues/32#issuecomment-467588832, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAidDcZoCDl4ZbANThSK0Fwva9MvgHyks5vRZE6gaJpZM4bGEue .

rickpastoor commented 5 years ago

I'm on 2.0.5

ayanko commented 5 years ago

There is mistake in documentation. You should use this one:

use RackSessionAccess::Middleware

Fixed README.

rickpastoor commented 5 years ago

Thanks, awesome!