#Can't connect to Redis

6 messages · Page 1 of 1 (latest)

trail creek
#
Railway

Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.

whole skiffBOT
#

Project ID: d8049c86-573e-4f40-ac79-a2281b82ce41,3cc1ff82-94b5-40c5-a5e2-08795f250823,8d6cf90e-5a9e-4216-bb69-69cc08360744,3ef07d24-788d-47a3-b6e4-176353377785

trail creek
#

Here is the code I am using to just test this:

const redisUrl = process.env.REDIS_URL;
console.log('Attempting to connect to Redis with URL:', redisUrl?.replace(/:[^:@]+@/, ':****@'));

// Initialize Redis client with REDIS_URL and family=0 for dual stack lookup
const redis = new Redis(process.env.REDIS_URL + '?family=0', {
  tls: {
      rejectUnauthorized: false
  },
  connectTimeout: 10000, // 10 seconds
  retryStrategy: (times) => {
      const delay = Math.min(times * 50, 2000);
      console.log(`Retrying Redis connection attempt ${times} with delay ${delay}ms`);
      return delay;
  }
});
#

Service variables:

#

I always get this error:

Redis connection error: Error: connect ETIMEDOUT

    at TLSSocket.<anonymous> (/app/node_modules/ioredis/built/Redis.js:170:41)

    at Object.onceWrapper (node:events:631:28)

    at TLSSocket.emit (node:events:517:28)

    at Socket._onTimeout (node:net:598:8)

    at listOnTimeout (node:internal/timers:569:17)

    at process.processTimers (node:internal/timers:512:7) {

  errorno: 'ETIMEDOUT',

  code: 'ETIMEDOUT',

  syscall: 'connect'

}

Error details: {

  code: 'ETIMEDOUT',

  errno: undefined,

  syscall: 'connect',

  message: 'connect ETIMEDOUT'

}
sleek edge
#

perhaps you are using an older version of ioredis that lacks IPv6 support outright?