Bull - Reached the max retries per request limit

Viewed 841

I am using npm bull to add my queue job to handle about sending mail for my project. It runs no problems for a long time, but recently, it shows this error: Error while handling task collect-metrics: Reached the max retries per request limit (which is 10). Refer to "maxRetriesPerRequest" option for details. error log And I checked in redis-cli: key *, it didn't show any key. The bull module support @bull-monitor/express to monitor the job, but since the error shows, I couldn't access the monitor bull admin panel here is my code

2 Answers

Bull can't find Redis to connect with. I'm was using bull in local environment and there is no problem, on the cloud the bull shows me the same error.

so in local environment it's connect to 127.0.0.1:6379, but in cloud you don't have this port so you need to specific the redis's username, redis's password and redis's port.

I faced this problem as well when I deployed my application to production. It turns out that Bull.js doesn't automatically allow a redis connection over TLS, especially the fact that the production environment is already running over TLS. So what fixed it for me was setting tls to true, and enableTLSForSentinelMode to false in the Redis options of my queue. Here's a sample code:

const myQueue = new Queue('my_queue', YOUR_REDIS_URL, {
  redis: { tls: true, enableTLSForSentinelMode: false },
  ...other queue options
})
Related