Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect ECONNREFUSED #12

Open
younes127 opened this issue Jan 21, 2022 · 0 comments
Open

Connect ECONNREFUSED #12

younes127 opened this issue Jan 21, 2022 · 0 comments

Comments

@younes127
Copy link

younes127 commented Jan 21, 2022

Hello,

I get the following error on the second request:

Error: connect ECONNREFUSED 127.0.0.1:11211
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1161:16)

It is worth mentioning that the requests are different but they access the same user session.

Request 1:

router.get('/login',(req,res) => {
  var sess = req.session;
  sess.email = req.query.email;
  res.send('done');
});

Request 2:

router.get('/admin',(req,res) => {
  var sess = req.session;
  if(sess.email) {
      res.send(`Hello ${sess.email}`);
  } else {
      res.send('Please login first.');
  }
});

My config:

const session = require("express-session");
var MemcachedStore = require('connect-memjs')(session);

...

app.use(session({
    store: new MemcachedStore({
      hosts: ["127.0.0.1:11211"]
    }),
    secret: '....',
    resave: false,
    saveUninitialized: false,
    proxy: true,
    cookie: {
        maxAge: 1000 * 60 * 15
    }
}));

Thanks greetings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant