I am having a problem connecting to my local and remote redis servers using BullModule.
Here is the error:
Error: connect ECONNREFUSED 127.0.0.1:6379
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:128:17) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 6379
}
Here is my application module setup:
@Global()
@Module({
imports: [
BullModule.registerQueue(
{ name: REPORTS_QUEUE_TOKEN, connection: {} },
),
...
],
...
})
export class ApplicationModule {
static forRoot(config: ApplicationModuleConfig): DynamicModule {
const {graphql,typeOrmConfig,numConcurrentReportJobs,redis: { tls: redisTls, ...redisRest }} = config;
const redis: ConnectionOptions = {
host: toString(redisRest.host),
port: toNumber(redisRest.port),
};
if (redisRest.password) redis.password = redisRest.password; .
return {
module: ApplicationModule,
imports: [
...
BullModule.forRoot({
connection: redis,
}),
...
],
};
}
constructor() {}
}
I can connect to the local redis server using redis-cli and I can get all the info and such:
127.0.0.1:6379> info
# Server
redis_version:7.2.4
redis_build_id:44edf16bebe6fed2
redis_mode:standalone
os:Linux 6.5.6-76060506-generic x86_64
... etc
** It seems that the host and port number are not being used by it's reverting to default values.**
Here are some of the nest packages I have in my package.json
"@nestjs/bullmq": "^10.0.1",
"@nestjs/common": "^10.3.1",
"@nestjs/core": "^10.3.1",
"@nestjs/microservices": "^10.3.1",
"@nestjs/typeorm": "^10.0.1",
"bullmq": "^5.1.7",
Can anyone tell me what it is I am doing wrong?
Thanks