question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

express-session compatibility issues

See original GitHub issue

I’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:closed
  • Created 7 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
leakycommented, Apr 24, 2016

Hi @langpavel

I’ve managed to fix this issue by adding {credentials: 'include'} tofetch` 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found