i'm getting csrf token errors..
typeerror: cannot read property '_csrf' of undefined @ object.handle (/home/nodejs/sites/icoderstuff/node_modules/express/node_modules/connect/lib/middleware/csrf.js:45:28) @ next (/home/nodejs/sites/icoderstuff/node_modules/express/node_modules/connect/lib/proto.js:190:15) @ object.session [as handle] (/home/nodejs/sites/icoderstuff/node_modules/express/node_modules/connect/lib/middleware/session.js:221:66) @ next (/home/nodejs/sites/icoderstuff/node_modules/express/node_modules/connect/lib/proto.js:190:15) @ object.cookieparser [as handle] (/home/nodejs/sites/icoderstuff/node_modules/express/node_modules/connect/lib/middleware/cookieparser.js:60:5) @ next (/home/nodejs/sites/icoderstuff/node_modules/express/node_modules/connect/lib/proto.js:190:15) @ object.methodoverride [as handle] (/home/nodejs/sites/icoderstuff/node_modules/express/node_modules/connect/lib/middleware/methodoverride.js:37:5) @ next (/home/nodejs/sites/icoderstuff/node_modules/express/node_modules/connect/lib/proto.js:190:15) @ object.expressvalidator [as handle] (/home/nodejs/sites/icoderstuff/node_modules/express-validator/lib/express_validator.js:148:10) @ next (/home/nodejs/sites/icoderstuff/node_modules/express/node_modules/connect/lib/proto.js:190:15)
packages ( packages.json )
"express": "3.0.3", "less-middleware": "0.1.12", "hbs": "2.3.0", "express-validator": "0.4.1", "mongoose" : "3.x", "node-uuid" : "1.x", "request" : "2.x", "async" : "0.2.x", "date-utils": "1.x", "jade": "0.31.2", "xml2js" : "0.2.7", "md5" : "1.0.3", "csv" : "0.3.3", "nodemailer" : "0.4.4"
server.js
app.configure(function(){ app.set('port', process.env.port || 8080); app.set('views', __dirname); app.set('view engine', 'html'); app.engine('html', require('hbs').__express); app.use(express.favicon()); app.use(express.logger('dev')); app.use(express.bodyparser()); app.use(expressvalidator); app.use(express.methodoverride()); app.use(express.cookieparser()); app.use(express.session({ secret: 'xkvnjiersape', store: store })); app.use(express.csrf()); app.use(express.static(path.join(__dirname, 'public'))); app.use(require('less-middleware')({ src: __dirname + '/public' })); app.use(require('grunt-contrib-livereload/lib/utils').livereloadsnippet); app.use(app.router); });
perhaps else, not sure if same cause me op. problem appeared me after restarting computer, , after embarrassingly long time figured out because redis (i used connect-redis session store) didn't restart automatically.
in other words seems typeerror: cannot read property '_csrfsecret' of undefined
or csrf of undefined
occurs when session store unavailable.
Comments
Post a Comment