I am using express 4.12.2, express-session 1.11.1, & connect-redis 1.4.7. When running the following code with NODE_ENV=production npm start:
var session = require('express-session');
var RedisStore = require('connect-redis')(session);
app.use(session({
store: new RedisStore(options),
secret: 'keyboard cat'
}));
I receive the following error:
var Store = connect.session.Store;
^
TypeError: Cannot read property 'Store' of undefined
Any help would be greatly appreciated.
1.4.7 is a pretty old version of connect-redis. The signature has changed since that version. Before it accepted a connect object, but since the 2.0 update with express 4 it now accepts a session object. Your code is already using the new signature so for this to work all you should need to do is update your package.json
...
"dependencies": {
...
"connect-redis": "^2.3.0"
}
...
and/or update the module in place:
npm install connect-redis
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With