Connecting to Redis App

I’ve been trying to send a job from my web app to my redis app, both deployed to Fly on the same region, ewr.

I am using Bull as my queue lib bull - npm

This is my code:

const Queue = require('bull');

const REDIS_URL = 'redis://:password@ewr.redis-queue.internal:6379'
const connectQueue = (name) => new Queue(name, REDIS_URL)

await connectQueue('my-queue')
      .on('completed', (job) => {
        console.log(`Job with id ${job.id} has been completed`)
      })
      .on('error', function (error) {
        console.log('My onError handler', error)
      })

And this is my error:

Error: getaddrinfo ENOTFOUND ewr.redis-queue.internal

.. redacted.. kTrampoline (node:internal/async_hooks:130:17) {
2022-04-21T18:52:22Z app[6fdba4f0] ewr [info]  errno: -3008,
2022-04-21T18:52:22Z app[6fdba4f0] ewr [info]  code: 'ENOTFOUND',
2022-04-21T18:52:22Z app[6fdba4f0] ewr [info]  syscall: 'getaddrinfo',
2022-04-21T18:52:22Z app[6fdba4f0] ewr [info]  hostname: 'redis-queue.internal'
2022-04-21T18:52:22Z app[6fdba4f0] ewr [info]}

I followed the guide: Redis on Fly and I can login and send a ping message, but I cannot for the life of me get my app to connect.

Ah … this sounds familiar :slight_smile: Maybe take a look at this thread, as I think the guy had the same issue with Bull:

Think it was the config needing IPv6, which it doesn’t default to.

Good point Greg!

Passing an object with “family”: 6 appears to have worked.

new Queue(name,
{
  redis: {
    family: 6,
    port: 6379,
    host: 'redis-queue.internal',
    password: .... ,
  },
})
1 Like