Redis using the private connection

leadbox
PRO

a month ago

Hi Railway Support Team,

I’m encountering an issue when trying to connect to Redis using the private connection within my project.

Here are the details:

  • I’m using the REDIS_PRIVATE_URL environment variable provided by Railway.

  • My NestJS service and Redis plugin are in the same Railway project.

  • The Redis connection string is something like:

    redis://default:<password>@redis.railway.internal:6379

  • When I try to connect using ioredis, I receive the following error:

[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis.railway.internal

t seems like the internal hostname redis.railway.internal is not resolving from within my API service container.

Can you help me confirm:

  1. Whether the Redis plugin is properly linked to my service?

  2. If there are any known DNS issues or misconfigurations preventing the service from resolving internal domains?

Let me know if you need access to my project or specific service IDs.

Thanks in advance!

Best regards,

Solved$20 Bounty

4 Replies

Railway
BOT

a month ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


a month ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 26 days ago


clashing
FREETop 1% Contributor

a month ago

Can you provide the snippet in which you are instantiating the redis class? (const redis = new Redis)


aalfath
PRO

a month ago

Hey, you have to use family: 0 during the initialization of Redis class.

Like so if you use NodeJS:

const Redis = require("ioredis");
const redis = new Redis(process.env.REDIS_PRIVATE_URL, {family: 0});

I've had the same problem and I was able to solve it that way.


leadbox
PRO

a month ago

family: 0 - work! Thank you!!!

Status changed to Solved brody 26 days ago


Redis using the private connection - Railway Help Station