Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

202
Visualizações
Connecting Redis microservice in NestJS causes app to get stuck

I'm trying to set up a simple hybrid app using Nest's documentation, but the app gets stuck without throwing.

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));

When I comment out app.startAllMicroservices() or the code connecting the microservice, the App running line is logged, with it, the app is stuck.

I am 100% certain Redis is up and running and responsive, I am using Bull which uses the same config and it runs just fine.

I have tried commenting out everything irrelevant to the above (everything besides the ConfigModule) in the app.module to no avail. Any help would be appreciated.

I am running the latest version of NestJS and its peer dependencies.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Just resolved a similar issue. As per the time of writing downgrade redis npm package to ^3 from anything high i.e ^4.

From nestjs microservice redis docs To start building Redis-based microservices, first install the required package (note as of now the supported Redis version is ^3, not the latest ^4):

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda