R
Railway17mo ago
Nicky

Private network

Hi! I have a similar issue to the one discussed here: https://discord.com/channels/713503345364697088/1122290612398477343 I have two services, A and B. Both services are running nodejs with fastify. A is a public service and wants to call the private service B. Whenever calling service B I get the following error: Error: connect ECONNREFUSED fd12:5f15:8f96::4f:8387:fcf5:8081 This is the endoint I'm calling using axios : http://my-address.railway.internal:8081/graphql Service B is running on port 8081, I've set it up from the env variables Any ideas?
11 Replies
Percy
Percy17mo ago
Project ID: 8a8bfe2d-1094-4b5f-834a-eba6388d0180
Nicky
Nicky17mo ago
8a8bfe2d-1094-4b5f-834a-eba6388d0180
pierre
pierre17mo ago
Hey there Nicky, as explained in that other thread, make sure that your fastify server is bound to all network interfaces, not just the ipv4 one
Nicky
Nicky17mo ago
Changing the host to :: when starting the app solved the problem. Thank you!
coldplayz
coldplayz16mo ago
Hello Nicky, did you change this host for service A or [private] service B? In other words, did you reference the private service with ::8081?
Brody
Brody16mo ago
they would have configured service B to listen on [::] since that's the service they are making a request to via the private network. but you are welcome to open your own help thread so we can help you with your issue directly!
Nicky
Nicky16mo ago
I just had to update service service B to listen on :: . And when I make calls from service A, I can reference it by the internal address
coldplayz
coldplayz16mo ago
Thanks for the clarification Brody. Would open a new thread, but thought to read existing related threads just in case I'm able to find a solution. Quick question Nicky: Did you enclose '::' in square brackets as in '[::]', or just '::'? Also, I'm assuming you still appended the service B port when referencing with the internal address.
Nicky
Nicky16mo ago
It's just '::'. I'm using nodejs with fastify and it looks something like: await app.listen(port, '::') And you don't need to reference the port when using the internal address. It's like calling any other api, you do it by their domain. The port is relevant only when you run the service locally. Hope it helps!
Brody
Brody16mo ago
unless service B is running on port 80, you definitely would need to use a port in the url when calling B from A works: https://utilities.up.railway.app/request-test?url=http://hello-world.railway.internal:3000 doesn't work: https://utilities.up.railway.app/request-test?url=http://hello-world.railway.internal
Want results from more Discord servers?
Add your server