Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

339
Views
TypeError: Cannot read properties of undefined (reading 'createClient')

so what I want to do is to create a session and store it in redis. I followed the API from this github repository https://github.com/tj/connect-redis.

But I am getting this error in the word client: The expected type comes from property 'client' which is declared here on type 'RedisStoreOptions'.

This is the code that i used:

import redis from 'redis';
import session from 'express-session';
import connectRedis from 'connect-redis';

const app = express();

    const RedisStore = connectRedis(session);
    const redisClient = redis.createClient({ legacyMode: true });
    redisClient.connect().catch(console.error);
    app.use(
        session({
          store: new RedisStore({ client: redisClient }),
          saveUninitialized: false,
          secret: "keyboard cat",
          resave: false,
        })
    )

The error occurs here:

store: new RedisStore({ client: redisClient })

More specifically in the word client.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

instead of

import redis from 'redis';

use

import * as redis from 'redis';
about 4 years ago · Juan Pablo Isaza Report

0

I'm guessing your using TypeScript, I had this issue, did you install:

@types/redis
@types/connect-redis
@types/express-session

I did that and kept getting an error with the client so I uninstalled all 3 @types and noticed redis doesn't require you to declare modules so I only installed types for express-session and connect-redis

npm i @types/connect-redis @types/express-session --save-dev


yarn add @types/connect-redis @types/express-session -D

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!