I've got a problem where one place in my code (the authentication part) puts something in the session, and another place in the code tries to access it (my GraphQL API part). The problem is, when the second part tries to get the data, it isn't there.
When I log request.session.id
I can see the core problem clearly: in between the two requests the session itself changes. The auth request happens, and does put the data in to session A, but when the graphQL code accesses request.session
it gets session B, with no data.
However, this is not a "please debug my code for me" request. Instead, I would just like to understand how the library works, so I can debug myself.
Can anyone please explain how/why express-session
decides (presumably on getting a new request) that it should abandon the old session and start a new one? From what I've read it likely has something to do with my domain settings, but I've tried playing with those without success, and really I just want to understand how the library works, specifically in terms of deciding to re-use a session or generate a new one.
from What Makes Express-Session Decide to Start a New Session?
No comments:
Post a Comment