redis-session-store icon indicating copy to clipboard operation
redis-session-store copied to clipboard

Regression in 0.11.4?

Open jherdman opened this issue 1 year ago • 1 comments

In 0.11.4 the following change was introduced:

3ee0426e88104048f624ed4ac1661feb8bb753f9

I'm seeing this exception raised in Rack v2.2.3.1:

NoMethodError:
       undefined method `cookie_value' for "e1af07cec3cbb9aade2800550652e7bc":String

This can be traced to this line:

https://github.com/rack/rack/blob/925a4a6599ab26b4f3455b525393fe155d443655/lib/rack/session/abstract/id.rb#L482-L484

It seems that the data returned by set_session is a simple string, but a different data structure is expected:

https://github.com/roidrage/redis-session-store/blob/e9a7d80c937c04896afe155bfc02e299e23fccf8/lib/redis-session-store.rb#L127-L139

If you dig into ActionDispatch::Session::CookieStore we can see that it's write_session implementation return a Rack::Session::SessionId instance (albeit decorated):

https://github.com/rails/rails/blob/04972d9b9ef60796dc8f0917817b5392d61fcf09/actionpack/lib/action_dispatch/middleware/session/cookie_store.rb#L104-L107

If one returns an appropriately crafted instance this package works again.

jherdman avatar Jul 19 '22 20:07 jherdman