Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

200
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!