Trying to connect Redis to nodejs API app
ntsagar9
HOBBYOP

2 months ago

Trying to connect Redis to nodejs API app

- Tried with private and public both URL but getting same error.
- In my local machine working fine and was used AWS EC2 there is also working fine. Here tried many things but not able to connect it.
- I used suggested variable {{Redis.REDIS_URL}} private and tried with public URL as well but not connecting.

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

Oct 15 2025 01:31:12

at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:111:26)

Oct 15 2025 01:31:14

[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis

$10 Bounty

12 Replies

Railway
BOT

2 months 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!


brody
EMPLOYEE

2 months 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 about 2 months ago



ntsagar9
HOBBYOP

2 months ago

Yes, I did it added family params but still getting same issue


Can you share the deployment logs of Redis? Not sure why both public and private would cause an issue.


ntsagar9
HOBBYOP

2 months ago

NodeJS logs

Oct 15 2025 01:48:20

[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis

Oct 15 2025 01:48:20

at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:111:26)

Oct 15 2025 01:48:20

[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis

Oct 15 2025 01:48:20

at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:111:26)

---- REDIS LOGS

1:M 14 Oct 2025 19:22:12.174 * <search> Acquired RedisJSON_V5 API

Oct 15 2025 00:52:12

1:M 14 Oct 2025 19:22:12.174 * Server initialized

Oct 15 2025 00:52:12

1:M 14 Oct 2025 19:22:12.174 * <search> Loading event starts

Oct 15 2025 00:52:12

1:M 14 Oct 2025 19:22:12.174 * <search> Enabled workers threadpool of size 4

Oct 15 2025 00:52:12

1:M 14 Oct 2025 19:22:12.176 * Loading RDB produced by version 8.2.1

Oct 15 2025 00:52:12

1:M 14 Oct 2025 19:22:12.176 * RDB age 2 seconds

Oct 15 2025 00:52:12

1:M 14 Oct 2025 19:22:12.176 * RDB memory usage when created 1.15 Mb

Oct 15 2025 00:52:12

1:M 14 Oct 2025 19:22:12.176 * Done loading RDB, keys loaded: 0, keys expired: 0.

Oct 15 2025 00:52:12

1:M 14 Oct 2025 19:22:12.176 * <search> Disabled workers threadpool of size 4

Oct 15 2025 00:52:12

1:M 14 Oct 2025 19:22:12.176 * <search> Loading event ends

Oct 15 2025 00:52:12

1:M 14 Oct 2025 19:22:12.176 * DB loaded from disk: 0.001 seconds

Oct 15 2025 00:52:12

1:M 14 Oct 2025 19:22:12.176 * Ready to accept connections tcp

Attachments


Do you have experimental IPv4 enabled in the feature flags tab? https://railway.com/account/feature-flags


ntsagar9
HOBBYOP

2 months ago

I tried both but not working
this is code and I debug config.redis.url this is getting as passed from env variable.

export const redisInstance = config.redis.url

? new Redis(config.redis.url + '?family=0', redisOptions)

: new Redis(redisOptions);

export const redis = redisInstance

.on("connect", () => {

logger.info("Redis connected successfully");

})

.on("error", async (err) => {

logger.error("Redis Error:", err);

await sendConnectionFailureEmail("Redis", err);

})

.on("ready", () => {

logger.info("Redis is ready to accept connections");

})

.on("close", () => {

logger.warn("Redis connection closed");

});


ntsagar9
HOBBYOP

2 months ago

Check this screenshot

Attachments


Hm. I have no idea why it's still failing to resolve. Just to be sure, can you share the config.redis.url value? It's equal to ${{Redis.REDIS_URL}} correct?


ntsagar9
HOBBYOP

2 months ago

Yes I double chcked that config.redis.url= ${{Redis.REDIS_URL}}


And you've tried redeploying both?


ntsagar9
HOBBYOP

2 months ago

Yes, redeploy both.
Als tried to create from start but facing same issue.
It was working fine in AWS EC2 but here having this issue. It stuck situation not sure how to fix that and where to look at that.

I tried to add hard code value for testing but getting same issue with both private and public URL


Loading...