有时当我重新加载页面时,服务器会发出此错误。当我重新启动服务器时它正在工作,但过了一段时间它再次发出同样的错误。我只在会话中存储user_id
。我也在使用Express.Io
Project/node_modules/express.io/node_modules/express/node_modules/connect/lib/middleware/session/memory.js:46
expires = 'string' == typeof sess.cookie.expires
^
TypeError: Cannot read property 'expires' of undefined
at Project/node_modules/express.io/node_modules/express/node_modules/connect/lib/middleware/session/memory.js:46:47
at process._tickCallback (node.js:419:13)
App.js
app.configure(function() {
app.use(express.logger('dev'));
app.use(express.cookieParser());
app.use(express.session({
secret: 'donkey',
cookie: {
maxAge: 12 * 3600000 // 12 hours
}}));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
});
快递版:3.4.8
连接版本:2.12
../middleware/session/memory.js
:http://pastie.org/9669160
同样的问题:https://github.com/techpines/express.io/issues/6
我尝试在每个路由中使用req.session.touch()
,这次我经常收到此错误(每次重新启动app.js)
Project/node_modules/express.io/node_modules/express/node_modules/connect/lib/middleware/session/session.js:50
this.cookie.maxAge = this.cookie.originalMaxAge;
^
TypeError: Cannot read property 'originalMaxAge' of undefined
at Session.resetMaxAge (Project/node_modules/express.io/node_modules/express/node_modules/connect/lib/middleware/session/session.js:50:35)
at Session.touch