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

Nest8 + redis still not working with npm #93

Open
lioralon326 opened this issue Oct 25, 2021 · 3 comments
Open

Nest8 + redis still not working with npm #93

lioralon326 opened this issue Oct 25, 2021 · 3 comments

Comments

@lioralon326
Copy link

Hello,

While working with nestjs-redis package I am getting the following error:

Nest can't resolve dependencies of the RedisCoreModule (Symbol(REDIS_MODULE_OPTIONS), ?). Please make sure that the argument ModuleRef at index [1] is available in the RedisCoreModule context

The issue was supposedly resolved in this issue https://github.com/skunight/nestjs-redis/issues/82,
but the changes were never rolled out when working with npm.

Using:
"@nestjs/common": "^8.1.1",
"@nestjs/core": "^8.1.1",

only workaround in the moment is either moving the package into the project, or using a different nestjs-redis source, like so:
"nestjs-redis": "git+https://github.com/skunight/nestjs-redis.git",

I am sure I am not the only one with this issue

@lioralon326 lioralon326 changed the title Nest8 + redis still not working woth npm Nest8 + redis still not working with npm Oct 25, 2021
@oflynned
Copy link

oflynned commented Oct 25, 2021

I faced a lot of problems with NestJS 8 and this Redis package, eventually I moved to the cache manager within NestJS as short term fix from the documentation. It works pretty similarly for my use cases.

import { CACHE_MANAGER, Inject, Injectable } from '@nestjs/common';
import { Cache } from 'cache-manager';

@Injectable()
export class CacheService {
  constructor(@Inject(CACHE_MANAGER) private readonly cache: Cache) {}

  async get(key: string): Promise<string> {
    return this.cache.get(key);
  }

  async set(key: string, value: string, ttl?: number): Promise<string> {
    if (ttl) {
      return this.cache.set(key, value, { ttl });
    }

    return this.cache.set(key, value);
  }
}

@volodyad
Copy link

volodyad commented Jan 25, 2022

@skunight could you please release npm package with nestj8 fix?

@Svaigas
Copy link

Svaigas commented Feb 9, 2022

@skunight looks like propsal of fix is working fine git+https://github.com/skunight/nestjs-redis.git#939f33a7f9b252e872c6edb76a3a860ed053bacf

Could you prepare and publish fix for that, please?

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

4 participants