У меня есть пользовательский модуль и модуль автофинала в моем проекте Nest. p>
**Error: Nest can't resolve dependencies of the AuthService (?, AuthRepository, JwtService, ConfigService, JwtService, SendgridService). Please make sure that the argument dependency at index [0] is available in the AuthModule context.
Potential solutions:
- Is AuthModule a valid NestJS module?
- If dependency is a provider, is it part of the current AuthModule?
- If dependency is exported from a separate @Module, is that module imported within AuthModule?
@Module({
imports: [ /* the Module containing dependency */ ]
})**
this is my code:
< /code>
@Injectable()
export class UserService {
constructor(
private readonly userRepository: UserRepository,
private readonly verificationService: VerificationService,
private eventEmitter: EventEmitter2,
private readonly authService: AuthService, < -- its errors when i add this.
private readonly sendgridService: SendgridService,
) {}
}
< /code>
@Module({
imports: [
TypeOrmModule.forFeature([User, Role]),
forwardRef(() => AuthModule),
VerificationModule,
SendgridModule,
],
controllers: [UserController],
providers: [UserService, UserRepository],
exports: [UserService, UserRepository],
})
export class UserModule {}
< /code>
@Module({
imports: [
TypeOrmModule.forFeature([Token]),
JwtModule.registerAsync({
inject: [ConfigService],
useFactory: async (configService: ConfigService) => ({
secret: configService.get('JWT_SECRET'),
signOptions: { expiresIn: GeneralMessage.JWT_TOKEN_EXPIRES_TIME },
}),
}),
forwardRef(() => UserModule),
SendgridModule,
],
controllers: [AuthController],
providers: [AuthService, AuthRepository],
exports: [AuthService, AuthRepository],
})
export class AuthModule {}
< /code>
How i searched forwardRef must help in this case, i added it but am getting same error...
Подробнее здесь: https://stackoverflow.com/questions/794 ... -injection
Проблемы с добавлением модуля и инъекции обслуживания ⇐ Javascript
Форум по Javascript
-
Anonymous
1739287295
Anonymous
У меня есть пользовательский модуль и модуль автофинала в моем проекте Nest. p>
**Error: Nest can't resolve dependencies of the AuthService (?, AuthRepository, JwtService, ConfigService, JwtService, SendgridService). Please make sure that the argument dependency at index [0] is available in the AuthModule context.
Potential solutions:
- Is AuthModule a valid NestJS module?
- If dependency is a provider, is it part of the current AuthModule?
- If dependency is exported from a separate @Module, is that module imported within AuthModule?
@Module({
imports: [ /* the Module containing dependency */ ]
})**
this is my code:
< /code>
@Injectable()
export class UserService {
constructor(
private readonly userRepository: UserRepository,
private readonly verificationService: VerificationService,
private eventEmitter: EventEmitter2,
private readonly authService: AuthService, < -- its errors when i add this.
private readonly sendgridService: SendgridService,
) {}
}
< /code>
@Module({
imports: [
TypeOrmModule.forFeature([User, Role]),
forwardRef(() => AuthModule),
VerificationModule,
SendgridModule,
],
controllers: [UserController],
providers: [UserService, UserRepository],
exports: [UserService, UserRepository],
})
export class UserModule {}
< /code>
@Module({
imports: [
TypeOrmModule.forFeature([Token]),
JwtModule.registerAsync({
inject: [ConfigService],
useFactory: async (configService: ConfigService) => ({
secret: configService.get('JWT_SECRET'),
signOptions: { expiresIn: GeneralMessage.JWT_TOKEN_EXPIRES_TIME },
}),
}),
forwardRef(() => UserModule),
SendgridModule,
],
controllers: [AuthController],
providers: [AuthService, AuthRepository],
exports: [AuthService, AuthRepository],
})
export class AuthModule {}
< /code>
How i searched forwardRef must help in this case, i added it but am getting same error...
Подробнее здесь: [url]https://stackoverflow.com/questions/79430476/having-problem-with-adding-module-and-service-injection[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия