mozilla/node-client-sessions

client-session not working with multer

Closed this issue · 1 comments

Hello! client-session is not created if i use multer with the route:

// other code here...
const multer = require('multer');
const multerUpload = multer({dest : '/tmp'}).single('file');
const session = require('client-sessions');
app.use(session({
	secret: "fd54g5fd465fd",
}));

app.post('/convert', multerUpload, function(req, res) {
// other code here....
req.session_state.user = 'username';
res.sendFile(__dirname + '/views/index.html');
}

req.session_state.user is undefined and session is not created.
If i remove the multerUpload from app.post() then session working!

Please, why is it working like that and how to fix the problem?

I resolved the problem.

The issue was with the size of data that can be stored in a session variable and not with multer. Maximal data size for session variable is 1KB.