a year ago
Hi,
This is a follow-up to my previous question on Monitoring Replica Instances (https://help.railway.com/questions/monitoring-replica-instances-89ab96a4).
I retrieved the IP of an internal instance and attempted to fetch data via HTTP using the following code:
const response = await fetch(`http://[fd12:7017:71::a7:5a59:4d60]/`, {
method: "GET",
});
However, I encountered the following error:
[cause]: Error: connect ECONNREFUSED fd12:7017:71::a7:5a59:4d60:80
at <unknown> (Error: connect ECONNREFUSED fd12:7017:71::a7:5a59:4d60:80) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: 'fd12:7017:71::a7:5a59:4d60',
port: 80
}
It seems that the client host is unable to access the server host.
Both the client and server are different services, but they are within the same project.
Could you provide guidance on how to resolve this issue?
Thank you!
5 Replies
a year ago
Hello,
You forgot the port in the URL.
Additionally since this is IPv6, make sure the service you are trying to call is listening on IPv6.
https://docs.railway.com/guides/private-networking#listen-on-ipv6
Status changed to Awaiting User Response Railway • about 1 year ago
a year ago
Do I need to use internal port? not 80?
Status changed to Awaiting Railway Response Railway • about 1 year ago
Status changed to Awaiting User Response Railway • about 1 year ago
a year ago
I figured it out.
You need to enable both IPv6 and IPv4 (dual stack).
You have to access using the internal port as you would in a Docker environment.
If IPv4 is not enabled, the Railway health check will fail.
It could be confusing because the health check uses port 80 and IPv4, while internal access requires IPv6 and an internal port.
Thank you.
Status changed to Awaiting Railway Response Railway • about 1 year ago
Status changed to Awaiting User Response Railway • about 1 year ago
Status changed to Solved brody • about 1 year ago