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:Jump to solution
you can not use the private network during build, do whatever needs to use redis during runtime
6 Replies
Project ID:
bffee644-ec55-4122-9e19-fee98c401647,05cba2ee-b344-4910-b0de-626add3247f7,ea6d0f24-f702-49ee-9b81-f69b204fa30e
Solution
you can not use the private network during build, do whatever needs to use redis during runtime
how would I initialize the redis connection at runtime then?
do not use it during build, or use the public network during build and the private network during runtime
ok, I will try that, thank you!
that worked, thanks Brody!
awesome!