I am attempting to create a basic hybrid app following the guidance provided by Nest's documentation, but I have run into an issue where the app becomes unresponsive without any errors being thrown.
main.ts
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { Logger } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
const logger = new Logger('Main');
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const configService = app.get(ConfigService);
const redisConfig = configService.get('database.redis');
app.connectMicroservice<MicroserviceOptions>({
transport: Transport.REDIS,
options: {
url: `redis://${redisConfig.host}:${redisConfig.port}`,
},
});
await app.startAllMicroservices();
await app.listen(configService.get('app.port'));
}
bootstrap()
.then(() => logger.log('App running'))
.catch((e) => logger.error(e));
By commenting out app.startAllMicroservices()
or the microservice connection code, the 'App running' message is logged. However, with this code included, the app freezes.
I can confirm that Redis is operational and responsive as I am successfully using Bull which shares the same configuration settings without issues.
I have attempted to eliminate any irrelevant code in the app.module
file, focusing only on the ConfigModule
, but the problem persists. Any assistance would be greatly appreciated.
I am utilizing the most recent version of NestJS along with its peer dependencies.