alexedwards/scs

scs: no session data in context in fiber framework

Koredeoluwafemi opened this issue · 3 comments

I am having this issue on the go fiber framework, I want to know how and where do I pass in the http.handler into the LoadAndSave middleware

NWBY commented

Stuck on this one as well. Anyone got any ideas?

cc @alexedwards

If you're getting a no session data in context error it means that the request context is not being propagated throughout the middleware -> handler chain correctly.

The scs.LoadAndSave method is standard net/http compatible middleware, so if Fiber isn't propagating the request context from it, then it sounds like either bug in the Fiber codebase or the result of a deliberate design decision by them. I think you'll need to pose this question to the Fiber team to get to the root of the problem.

I've updated the compatibility note in the README to warn people that using Fiber with this package may not work correctly: https://github.com/alexedwards/scs#compatibility

As mentioned above, I think the incompatibility exists due to a design decision by the Fiber developers to not propagate request context, rather than there being a bug with SCS. So I'm going to close this issue but if you disagree then please reopen.