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

Hello, I have a next.js project deploying in a railway service with a redis service attached. I set the REDIS_URL variable on the next project to ${{Redis.REDIS_PRIVATE_URL}}, and I can see from my logs that the app tries to connect to the internal url: "REDIS_URL: redis://default:[email protected]: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] (node:dns:120:26) { #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
Railway
Railway
Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.
Solution:
you can not use the private network during build, do whatever needs to use redis during runtime
Jump to solution
6 Replies
Percy
Percy2mo ago
Project ID: bffee644-ec55-4122-9e19-fee98c401647,05cba2ee-b344-4910-b0de-626add3247f7,ea6d0f24-f702-49ee-9b81-f69b204fa30e
Solution
Brody
Brody2mo ago
you can not use the private network during build, do whatever needs to use redis during runtime
Alexandru
AlexandruOP2mo ago
how would I initialize the redis connection at runtime then?
Brody
Brody2mo ago
do not use it during build, or use the public network during build and the private network during runtime
Alexandru
AlexandruOP2mo ago
ok, I will try that, thank you! that worked, thanks Brody!
Brody
Brody2mo ago
awesome!
Want results from more Discord servers?
Add your server