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

Double prefix #278

Closed
fynncfchen opened this issue Aug 29, 2019 · 1 comment
Closed

Double prefix #278

fynncfchen opened this issue Aug 29, 2019 · 1 comment

Comments

@fynncfchen
Copy link

Version: v4.0.0

Setup:

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

const RedisSessionStore = connectRedis(session);
const redisSessionClient = redis.createClient({
  host: '',
  port: '',
  password: '',
  prefix: 'sess:',
});
const redisSessionStore = new RedisSessionStore({
  client: redisSessionClient,
});

Actual Result:

sess:sess:nB9Rf0wRY-w6Ig2rvWOYhRMuusBmi90R

Expect Result:

sess:nB9Rf0wRY-w6Ig2rvWOYhRMuusBmi90R

Workaround:

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

const RedisSessionStore = connectRedis(session);
const redisSessionClient = redis.createClient({
  host: '',
  port: '',
  password: '',
});
const redisSessionStore = new RedisSessionStore({
  client: redisSessionClient,
  prefix: 'sess:',
});
@wavded
Copy link
Collaborator

wavded commented Aug 29, 2019

Correct, the store always sets a prefix by default, ensuring it exists regardless how the client is set up. If a client, such as redis in your example also supports adding a prefix it will be duplicated. I will add some notes to the readme.

@wavded wavded closed this as completed Aug 29, 2019
wavded added a commit that referenced this issue Aug 29, 2019
jellis24 added a commit to jellis24/connect-redis that referenced this issue Apr 6, 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