Reputation: 69
I have a project using NestJS version 9.2.0 with Bull Queue version 4.9.0 which is connecting to Redis to schedule jobs.
Locally this is working as expected, however, when deploying to staging then Bull won't connect and it fails with error maxRetriesPerRequest
.
My assumption is that on staging Bull is not being able to connect over TLS connection, however I am unable to confirm that this is definitely the issue.
I have tried the following without having any success:
rediss://.....
?tls=true
at the end of the Redis urltls: {}
object as part of the Redis configuration which I then use within the BullModule
that I am importing as use as factory within the app.module
fileThe reasons why I suspect it is an issue related to TLS connection:
Upvotes: 3
Views: 1658
Reputation: 1
I had a same issue on production environment, and my problem was a bullModule setting.
My app.module.ts was like:
BullModule.registerQueue(
{
name: 'a',
redis: {
host: process.env.REDIS_HOST,
port: Number(process.env.REDIS_PORT),
},
},
{
name: 'b',
redis: {
host: process.env.REDIS_HOST,
port: Number(process.env.REDIS_PORT),
},
},
),
I fixed it like:
BullModule.forRoot({
redis: {
host: process.env.REDIS_HOST,
port: Number(process.env.REDIS_PORT),
},
}),
BullModule.registerQueue(
{
name: 'a',
},
{
name: 'b',
},
),
After I fixed my code this way, it works just fine. (You can also follow the nest.js document.)
Upvotes: 0