Nicolas Menettrier
Nicolas Menettrier

Reputation: 1679

NestJS cacheModule can't connect to Redis store with password

I'm trying to connect to my redis store in NestJS using CacheModule, I updated my store to put a password but now it's impossible to connect from NestJS (work perfectly with redis-cli and it works on nestJS before putting the password).

I have tried this:

import * as redisStore from 'cache-manager-redis-store'; // v2.0

@Module({
  imports: [
    CacheModule.register({
      store: redisStore,
      url: 'redis://:azerty@localhost:6379/0', // 'redis://h:azerty@localhost:6379/0' and 'redis://default:azerty@localhost:6379/0'
    }),
  ],
  controllers: [],
  providers: [],
})

The connection string is working with redis-cli but not in NestJS, it throws ReplyError: WRONGPASS invalid username-password pair or user is disabled. or ReplyError: Ready check failed: NOAUTH Authentication required. (depends on the connection string)

I also tried the "normal" way:

    CacheModule.register({
      store: redisStore,
      host: 'localhost',
      port: 6379,
      auth_pass: 'azerty', // also tried password: 'azerty'
    }),

I got the same errors as the connection string one ReplyError: Ready check failed: NOAUTH Authentication required..

How can I make it works ?

Upvotes: 0

Views: 4830

Answers (1)

Nicolas Menettrier
Nicolas Menettrier

Reputation: 1679

REMINDER: always check if there is multiple instance of CacheModule in your project, just lost 1 day of work because of that.

Upvotes: 1

Related Questions