Reputation: 157
Trying to add a redis store to my express server. When I run the server without adding the redisStore in the app.use(session(()) section I'm able to login without any problems. The issue is as soon as I add store: new RedisStore() the login will hang indefinitely and not call any of the console.logs inside my strategy.
Ive tried to figure out what could cause this but I've never had this issue before using a redis store. The redisclient connects successfully and outputs the console.log that it has connected so I have all of the correct server information.
Removed imports that arent important to make it easier to read
const redisClient = createClient({
url: `redis://${process.env.REDIS_HOST}:${process.env.REDIS_PORT}`,
password: process.env.REDIS_PASSWORD,
});
redisClient.connect();
redisClient.on('connect', function (err) {
console.log('Connected to redis successfully');
});
redisClient.on('error', function (err) {
console.log('Could not establish a connection with redis. ' + err);
});
const RedisStore = connectRedis(session);
Upvotes: 0
Views: 179
Reputation: 3184
connect-redis
only supports v4
with legacyMode
. See here.
Upvotes: 2