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

nestjs not started #1004

Closed
NikyOFF opened this issue Dec 1, 2022 · 1 comment
Closed

nestjs not started #1004

NikyOFF opened this issue Dec 1, 2022 · 1 comment

Comments

@NikyOFF
Copy link
Contributor

NikyOFF commented Dec 1, 2022

Description

After i start my appliaction i waiting some log like "Nest application successfully started" but it doesn't happen

Solution

The problem is 'await' before bot.launch in nestjs-telegraf package

#1003


My environment

src/main.ts

import { NestFactory } from '@nestjs/core';
import { AppModule } from './modules/app/app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  await app.listen(3000);
}
bootstrap();

src/modules/app/app.module.ts

import { Module } from "@nestjs/common";
import { TelegrafModule } from "nestjs-telegraf";
import { MainUpdate } from "./updates/main.update";
import { ConfigModule, ConfigType } from "@nestjs/config";
import TelegramConfigLoader from "@modules/telegram/config/telegram-config.loader";

@Module({
  imports: [
    TelegrafModule.forRootAsync({
      imports: [ConfigModule.forFeature(TelegramConfigLoader)],
      useFactory: (telegramConfig: ConfigType<typeof TelegramConfigLoader>) => ({
        token: telegramConfig.token,
      }),
      inject: [TelegramConfigLoader.KEY],
    })
  ],
})
export class AppModule {}

package.json

"dependencies": {
    "@nestjs/common": "^9.0.0",
    "@nestjs/core": "^9.0.0",
    "@nestjs/platform-express": "^9.0.0",
    "nestjs-telegraf": "^2.6.2",
    "telegraf": "^4.11.2",
  }

input

$ npm run start:dev

output

LOG [NestFactory] Starting Nest application...
LOG [InstanceLoader] TelegrafModule dependencies initialized
LOG [InstanceLoader] AppModule dependencies initialized
LOG [InstanceLoader] DiscoveryModule dependencies initialized
@evilsprut
Copy link
Contributor

Fixed in v2.6.3, thx!

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

2 participants