mozilla / node-client-sessions

secure sessions stored in cookies
Mozilla Public License 2.0
759 stars 104 forks source link

client-session not working with multer #126

Closed Elio-Shyti closed 7 years ago

Elio-Shyti commented 7 years ago

Hello! client-session is not created if i use multerwith 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 undefinedand 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?

Elio-Shyti commented 7 years ago

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.