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

Not working properly in Nestjs 10.0.0 version #1134

Open
erosiners opened this issue Sep 1, 2023 · 5 comments
Open

Not working properly in Nestjs 10.0.0 version #1134

erosiners opened this issue Sep 1, 2023 · 5 comments

Comments

@erosiners
Copy link

erosiners commented Sep 1, 2023

Not working properly in Nestjs 10.0.0 version

"dependencies": {
    "@nestjs/common": "^10.0.0",
    "@nestjs/core": "^10.0.0",
    "@nestjs/platform-express": "^10.0.0",
    "https-proxy-agent": "^7.0.1",
    "nestjs-telegraf": "^2.7.0",
    "reflect-metadata": "^0.1.13",
    "rxjs": "^7.8.1",
    "socks-proxy-agent": "^8.0.1",
    "telegraf": "^4.12.2"
  }
@Module({
  imports: [
    TelegrafModule.forRoot({
      token: token,
      include: [BotModule],
    }),
    UserModule,
    BotModule,
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule{}

@Module({
  providers: [BotUpdate, BotService],
})
export class BotModule {}

error message

Error: Nest can't resolve dependencies of the BotUpdate (?, BotService). Please make sure that the argument testBot at index [0] is available in the BotModule context.

Potential solutions:
- Is BotModule a valid NestJS module?
- If testBot is a provider, is it part of the current BotModule?
- If testBot is exported from a separate @Module, is that module imported within BotModule?
  @Module({
    imports: [ /* the Module containing testBot */ ]
  })
@LoboAnimae
Copy link

Everything seems to be working properly on my end.

I think testBot should be inside the providers section of BotModule, such as to:

@Module({
  providers: [BotUpdate, BotService, testBot],
})
export class BotModule {}

I cannot tell what testBot is. Is it a service?

@C0DDER
Copy link

C0DDER commented Sep 13, 2023

any update on this? I faced the same problem

@C0DDER
Copy link

C0DDER commented Sep 13, 2023

Everything seems to be working properly on my end.

I think testBot should be inside the providers section of BotModule, such as to:

@Module({
  providers: [BotUpdate, BotService, testBot],
})
export class BotModule {}

I cannot tell what testBot is. Is it a service?

in my case it is the bot name specified in the @InjectBot() decorator

@warriorBrian
Copy link

@erosiners Have you solved this problem? I also encountered the same problem.

@warriorBrian
Copy link

warriorBrian commented Nov 28, 2023

@evilsprut When injecting the bot, I will be prompted to report an error. I think this is a mistake.

code:

constructor(
		private readonly configService: ConfigService,
		@InjectBot('health') private bot: Telegraf
	) {}

Error:

Please make sure that the argument "healthBot" at index [5] is available in the HealthModule context.

Potential solutions:
- Is HealthModule a valid NestJS module?
- If "healthBot" is a provider, is it part of the current HealthModule?
- If "healthBot" is exported from a separate @Module, is that module imported within HealthModule?
  @Module({
    imports: [ /* the Module containing "healthBot" */ ]
  })

And I don’t know where to solve this healthBot?

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