R
Railway8mo ago
Nafi

Can't connect to redis internal but can over ipv4 addr

I am trying to use the railway internal network for a Redis store in a NodeJS server but I can only connect using the external ipv4 address. Here is the JS connection logic:
const redisClient = createClient({ url: process.env.REDIS_URL });
await redisClient.connect();
const redisClient = createClient({ url: process.env.REDIS_URL });
await redisClient.connect();
REDIS_URL is a service variable defined in the NodeJS service. ipv4 address: redis://default:(password here)@viaduct.proxy.rlwy.net:27261 ipv6 address: redis://default:(password here)@redis.railway.internal:6379 I have also tried redis://default:(password here)@redis:6379 as this is valid schema. Error Log:
node:internal/process/promises:289

triggerUncaughtException(err, true /* fromPromise */);

^

Error: getaddrinfo ENOTFOUND redis

at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:118:26)

Emitted 'error' event on Commander instance at:

at RedisSocket.<anonymous> (/usr/src/app/node_modules/@redis/client/dist/lib/client/index.js:412:14)

at RedisSocket.emit (node:events:519:28)

at RedisSocket._RedisSocket_connect (/usr/src/app/node_modules/@redis/client/dist/lib/client/socket.js:166:18)

at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

at async Commander.connect (/usr/src/app/node_modules/@redis/client/dist/lib/client/index.js:185:9)

at async /usr/src/app/index.js:38:3 {

errno: -3008,

code: 'ENOTFOUND',

syscall: 'getaddrinfo',

hostname: 'redis'

}

Node.js v21.7.1
node:internal/process/promises:289

triggerUncaughtException(err, true /* fromPromise */);

^

Error: getaddrinfo ENOTFOUND redis

at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:118:26)

Emitted 'error' event on Commander instance at:

at RedisSocket.<anonymous> (/usr/src/app/node_modules/@redis/client/dist/lib/client/index.js:412:14)

at RedisSocket.emit (node:events:519:28)

at RedisSocket._RedisSocket_connect (/usr/src/app/node_modules/@redis/client/dist/lib/client/socket.js:166:18)

at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

at async Commander.connect (/usr/src/app/node_modules/@redis/client/dist/lib/client/index.js:185:9)

at async /usr/src/app/index.js:38:3 {

errno: -3008,

code: 'ENOTFOUND',

syscall: 'getaddrinfo',

hostname: 'redis'

}

Node.js v21.7.1
6 Replies
Percy
Percy8mo ago
Project ID: b88cd4f4-3e33-4c82-8bb1-90877719ae87
Nafi
NafiOP8mo ago
b88cd4f4-3e33-4c82-8bb1-90877719ae87 @Brody any ideas?
Brody
Brody8mo ago
do you have a 3 second sleep?
Nafi
NafiOP8mo ago
I do not could you elaborate I only connect to redis via a specific endpoint, its not instant so the delayed internal start isnt the issue here (probably)
Duchess
Duchess4mo ago
New reply sent from Help Station thread:
@nxfi777 I'm also facing the same issue. Seems like the REDIS_URL is undefined even though it's set in the project variables. How did you fix it?
You're seeing this because this thread has been automatically linked to the Help Station thread.
Want results from more Discord servers?
Add your server