express-session compatibility issues
See original GitHub issueI’ve integrated express-session with hopes of using sessions to store user-specific data, however it seems that the session ID is not persisting at all when running the application in development mode on port 3000.
I have integrated express-session like so below:
server.use(session({
secret: "keyboardcat",
resave: true,
saveUninitialized: true,
proxy: true,
cookie: {
secure: false,
maxAge: 6000000
}
}));
server.use(function (req, res, next) {
console.log(req.sessionID);
next();
});
req.sessionID
has a different value on every single request. If (still in development) I switch to port 5000 then the sessionID does seem to be persisting but there’s no JS functionality on 5000.
I thought that browsersync could have been the issue but after running npm run build
and then node build/server.js
the session ID is still not persisting, it only persists on 5000 in development.
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Interoperability with express-session · Issue #332 - GitHub
I have a legacy app which passes Express session cookies over non-HTTP connections (think websockets or backend message queues). The app used ...
Read more >express-session - npm
For a list of stores, see compatible session stores. Options. express-session accepts these properties in the options object. cookie. Settings ...
Read more >node.js - Express-Session is not persisting in production
I am trying to run my nodejs application on gcloud production and the express-session is not working as expected.
Read more >Should you use Express-session for your ... - SuperTokens
This article will analyse the good and bad parts of express-session so that you can make an informed decision for your next app....
Read more >Should You Use Express-Session for Your Production App?
While being Node's most popular session management library, express-session has its set of flaws and weaknesses – especially when it comes ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@leaky @Jaikant https://tonyspiro.com/how-to-keep-session-data-after-fetch-post-with-express/#comment-2544007117
Hi @langpavel
I’ve managed to fix this issue by adding
{credentials: 'include'} to
fetch` requests.Another incurring factor was that I had modified the Link component to perform
window.location = xxx
on each page navigation rather than history change as I wanted to have a “loading” animator but as far as I could see there was no way to turn a loading notification on/off on page navigation? (please correct me if I am wrong!)I’m using react-starter-kit to trial-build an eCommerce store.