redis connection to node backend railway

maddox05HOBBY

9 months ago

Hello! Id love to connect my node backend to redis. I can connect it over the public url but that will hold additional costs, I would like to be able to connect using the private url env variable. on my backend I added the var they told me to but it fails to connect. i use the env var REDIS_URL = ${{Redis.REDIS_URL}}

Solved

13 Replies

maddox05HOBBY

9 months ago

pls reply


9 months ago

We would need an actual error message here.


maddox05HOBBY

9 months ago

I print out the redis url from node and its nothing, all my other vars are correct however. the error message states cant connect to redis, as such I printed it out.


maddox05HOBBY

9 months ago

I want to get the team plan but I cant get it yet as if I have to use the public url and will add egress costs


9 months ago

Please see my above message, we need an actual error message to help you debug this.

Without an error message the best I can do for you is to send you this link - https://docs.railway.app/guides/private-networking#known-configuration-requirements-for-ipv6


maddox05HOBBY

9 months ago

Failed to connect to redis

Sep 17 15:08:59

Error: connect ECONNREFUSED ::1:6379

Sep 17 15:08:59

at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {

Sep 17 15:08:59

errno: -111,

Sep 17 15:08:59

code: 'ECONNREFUSED',

Sep 17 15:08:59

syscall: 'connect',

Sep 17 15:08:59

address: '::1',

Sep 17 15:08:59

port: 6379

Sep 17 15:08:59

}

here u go

this is for a node express backend


maddox05HOBBY

9 months ago

yo


maddox05HOBBY

9 months ago

pls


9 months ago

The error message of ECONNREFUSED ::1:6379 indicates you have a code issue, mainly you are incorrectly using your redis config, likely incorrect syntax.

Use the correct syntax as per your client's documention, along with using environment variables.


maddox05HOBBY

9 months ago

hi! as I stated prior it works for the public url but not the private. I have read your docs for the private url and sleeping 10 seconds.



maddox05HOBBY

9 months ago

hi! im not sure what you mean. I do use redis in my project. could you explain more?


maddox05HOBBY

9 months ago

I think i see my issue now, I can deploy multiple things on same project


Status changed to Solved brody 8 months ago


redis connection to node backend railway - Railway Help Station