skip to Main Content

I’m using the very basic example (const queue = new Queue('Paint')) from the https://www.npmjs.com/package/bullmq page – everything works fine (it defaults to localhost:6379).

However when I add a connection (new Queue('Paint', { connection })) that’s based on a TLS access to Redis (rediss://...), I can still push jobs into the queue (which I see in the Redis itself), but none of these jobs get pulled by the worker.

Maybe I’m missing some hidden flag?

Thanks!

-Dror

2

Answers


  1. Chosen as BEST ANSWER

    I found out what happened - although I'm still not sure why:

    I was using ioredis as the connection for bull when the problem surfaced. When I replaced it with redis it started working properly, pulling jobs out of the queue.

    Both packages has full support for Redis over TLS, but for some reason the integration with bull didn't work out for ioredis.

    -Dror


  2. This happens due to manual and incomplete parsing of redis url here: https://github.com/OptimalBits/bull/blob/develop/lib/queue.js#L308

    rediss:// vs redis:// is simply not taken into account.

    To workaround this issue I had to add more keys to additional ‘redis’ key:

    export const REDIS_CONNECTION: Redis.RedisOptions = {
      ...(REDIS_URL.startsWith('rediss://') ? { tls: {} } : null), // This trick makes sure SSL would work
      retryStrategy: (times) => {
        // reconnect after
        return Math.min(times * 50, 2000);
      },
    };
    
    export const queue = new Bull<JobData>('foobar', REDIS_URL, {
      redis: REDIS_CONNECTION,
    ...
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search