I'm using client-sessions (https://github.com/mozilla/node-client-sessions) with async (https://github.com/caolan/async) but am unable to update the user session from within an async waterfall function. I'm wondering if I'm doing something obviously wrong:
app.get('/', function (req, res) {
console.log(req.session) // first request logs: {}, second request logs: {foo: 'bar'}
req.session.foo = 'bar'
async.waterfall([
function(callback){
req.session.baz = 'bip'
}
], function(){
console.log(req.session) // this logs full object: { foo: 'bar', baz: 'bip' }
})
res.send('')
})
It seems like the second request should have baz: 'bip' in the session object, but it doesn't. Why?