Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

this.client.del is not a function #372

Closed
scriptsure opened this issue Dec 20, 2022 · 1 comment
Closed

this.client.del is not a function #372

scriptsure opened this issue Dec 20, 2022 · 1 comment

Comments

@scriptsure
Copy link

Using version 6.1.3 and I seem to be receiving the following error when access a v7 redis cluster on aws.

TypeError: this.client.del is not a function
15|platform    |     at RedisStore.destroy (/home/ubuntu/sites/platform/node_modules/connect-redis/lib/connect-redis.js:84:19)
15|platform    |     at ServerResponse.end (/home/ubuntu/sites/platform/node_modules/express-session/index.js:310:15)
15|platform    |     at ServerResponse.send (/home/ubuntu/sites/platform/node_modules/express/lib/response.js:232:10)
15|platform    |     at ServerResponse.json (/home/ubuntu/sites/platform/node_modules/express/lib/response.js:278:15)

We were on a much older version of the npm and recently upgraded. Here my connection:

const redis = require("redis");
var RedisStore = require('connect-redis')(session);

const redisClient = redis.createClient({
    url: `redis://${config.redis.host}:${config.redis.port}`,
    legacyMode: true
});

var redisStore = new RedisStore({
    client: redisClient.connect(), 
    logErrors: true,
});
@wavded
Copy link
Collaborator

wavded commented Dec 21, 2022

It seems you are passing the result of redisClient.connect() (which is a Promise) as the client value for the RedisStore. You would need to connect outside of creating the store, and pass use the redisClient as the client. E.g.

const redis = require("redis");
var RedisStore = require('connect-redis')(session);

const redisClient = redis.createClient({
    url: `redis://${config.redis.host}:${config.redis.port}`,
    legacyMode: true
});

redisClient.connect().catch(console.error)

var redisStore = new RedisStore({
    client: redisClient, 
    logErrors: true,
});

@wavded wavded closed this as completed Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants