Closed Elio-Shyti closed 7 years ago
Hello! client-session is not created if i use multerwith the route:
multer
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!
req.session_state.user
undefined
multerUpload
app.post()
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.
session variable
1KB
Hello! client-session is not created if i use
multer
with theroute
:req.session_state.user
isundefined
and session is not created. If i remove themulterUpload
fromapp.post()
then session working!Please, why is it working like that and how to fix the problem?