Skip to content

Nest can't resolve dependencies of the RedisService - Symbol(REDIS_CLIENT) #74

Open
@invertedcrow

Description

Hi! Can anyone help me?

On Application start i got this error:

Nest can't resolve dependencies of the RedisService (?). Please make sure that the argument Symbol(REDIS_CLIENT) at index [0] is available in the RedisModule context.

my source

config

import { RedisModuleOptions } from 'nestjs-redis';

export const redis: RedisModuleOptions = {
  name: 'redis',
  host: process.env.REDIS_HOST,
  port: parseInt(process.env.REDIS_PORT),
  db: parseInt(process.env.REDIS_DB),
  password: process.env.REDIS_PASSWORD,
};

module

import { Module } from '@nestjs/common';
import { RedisModule, RedisService } from 'nestjs-redis';
import { MyRedisService } from './redis.service';

import { redis } from './redis.config';
@Module({
  imports: [RedisModule.register(redis)],
  providers: [MyRedisService, RedisService],
  exports: [MyRedisService],
})
export class MyRedisModule {}

service

mport { Injectable } from '@nestjs/common';
import { RedisService } from 'nestjs-redis';

@Injectable()
export class MyRedisService {
  constructor(private readonly _redisService: RedisService) {}
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions