jeremyevans/roda

Sidekiq::Web breaks roda session

Closed this issue · 1 comments

I've integrated Sidekiq::Web (a standard rack app) into roda like so:

plugin :sessions, secret: my_secret

route do |r|
  r.on 'sidekiq' do
    r.run Sidekiq::Web
  end
end

But when I return to any part of my app after visiting /sidekiq, my session gets corrupted. I threw in a binding.pry to investigate and:

session
# => "#<Rack::Session::Abstract::SessionHash:0x000055cbb168e48>"
session.class
# => String

Basically the roda session variable is being populated with a string descriptor of (presumably) the object Sidekiq uses to manage sessions. Is there something I need to do to make roda work with rack apps that use standard rack cookies? Or do you think this is likely to be a problem on Sidekiq's side of the fence?

You should use roda/session_middleware for cases like this where you are having another application or middleware access the session: https://github.com/jeremyevans/roda/blob/master/lib/roda/session_middleware.rb