Redis Client Error Error: getaddrinfo ENOTFOUND redis.railway.internal

alex-wirebeePRO

7 months ago

Hello, I have a next.js project deploying in a railway service with a redis service attached. I set the REDISURL variable on the next project to ${{Redis.REDISPRIVATEURL}}, and I can see from my logs that the app tries to connect to the internal url: "REDISURL: redis://default:password@redis.railway.internal:6379". However, when my redis client (using redis package) tries to connect to that url, I get this error:

13 29.05 app:build: Redis Client Error Error: getaddrinfo ENOTFOUND redis.railway.internal

13 29.05 app:build: at GetAddrInfoReqWrap.onlookupall as oncomplete {

13 29.05 app:build: errno: -3008,

13 29.05 app:build: code: 'ENOTFOUND',

13 29.05 app:build: syscall: 'getaddrinfo',

13 29.05 app:build: hostname: 'redis.railway.internal'

13 29.05 app:build: }

If I switch to use the ${{Redis.REDIS_URL}} that uses the proxy, the connection works.
URL to the build logs: https://railway.app/project/bffee644-ec55-4122-9e19-fee98c401647/service/05cba2ee-b344-4910-b0de-626add3247f7?id=ea6d0f24-f702-49ee-9b81-f69b204fa30e#build

0 Replies

7 months ago

you can not use the private network during build, do whatever needs to use redis during runtime


alex-wirebeePRO

7 months ago

how would I initialize the redis connection at runtime then?


7 months ago

do not use it during build, or use the public network during build and the private network during runtime


alex-wirebeePRO

7 months ago

ok, I will try that, thank you!


alex-wirebeePRO

7 months ago

that worked, thanks Brody!


7 months ago

awesome!


hknfrtHOBBY

5 months ago

I have same problem, how doyo solve it here err:Unhandled error event: Error: getaddrinfo ENOTFOUND redis.railway.internal


5 months ago

please open your own thread


Redis Client Error Error: getaddrinfo ENOTFOUND redis.railway.internal - Railway Help Station