skip to Main Content

I am using BullModule in nest.js.

when I connect to a local redis it works:

const REDIS = {
  host: 'localhost', 
};

@Module({
  imports: [
    TaskTypesModule,
    TasksModule,
    ScheduleModule.forRoot(),
    BullModule.forRoot({
      // @ts-ignore
      redis: REDIS,
    }),
  ],
  controllers: [AppController],
  providers: [AppService, PrismaService],
})
export class AppModule {}

But when I connect to a remote system

const REDIS = {
  host: process.env.REDIS_ENDPOINT,
  port: process.env.REDIS_PORT,
  password: process.env.REDIS_PASSWORD,
};

with env file

REDIS_USERNAME=default
REDIS_PASSWORD=p----------------------S
REDIS_ENDPOINT=redis-1xxxxx4.c261.us-east-1-4.ec2.cloud.redislabs.com
REDIS_PORT=1xxxxx4

it doesn’t write to the redis queue; by way of comparison, I can connect via redisight:

redsight connection

So – bottom line – how to configure the redis node for a remote connection in Bull?

2

Answers


  1. Maybe the env file hasn’t been loaded yet. You can try adding import 'dotenv/config' at the top of this file.

    Login or Signup to reply.
  2. For what I have tested, bull settings never accept a redis port different than its default, 6379.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search