Need to access session object for the session to save or set cookies? #1040
-
Hi, Not sure if this is a weird issue or not, but my app suddenly stopped saving sessions and setting cookies. This was my express log for the route I was hitting:
Accessing the session object immediately after setting it up
Fixes the issue, and sessions start saving again and cookies are set. I was just wondering why that might be? Here's the new log with the above code:
Here's my app.js file. Commenting out the above lines causes the code to break.
Any ideas why that might be? Am I making a mistake when setting up Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
To answer your top question, you have both |
Beta Was this translation helpful? Give feedback.
-
Ah ok, I hadn't realised that applied to new sessions. That makes sense, thanks! |
Beta Was this translation helpful? Give feedback.
To answer your top question, you have both
resave
andsaveUninitialized
set tofalse
, so yes you would need to alter your session for the cookie to set, as that is how you configured your session module.