One service sometimes cannot connect to another in same project
michalkalita
HOBBYOP

a month ago

Hi,
I have a project with FE and BE services, FE makes request directly to internal address of BE (http://directus.railway.internal:8055).
Note: It's server side rendering in Next.js, it doesnt make this request on client side in browser of course. I know this dns is internal and cannot work from internet.

Some deployments, randomly, cannot connect to BE. Node.js error is Error [ConnectTimeoutError]: Connect Timeout Error (attempted addresses: fd12:4dfd:218e:1:1000:30:1f4c:c2ea:8055, 10.204.194.234:8055, timeout: 10000ms)

I just need to run Redeploy (FE) on absolutely same configuration and it start working.

Deployment id with this issue a940219c-7241-49b8-89f4-ea5b48977213

Solved

3 Replies

Railway
BOT

a month ago


Can you ensure that your application is listening on both IPv6 and IPv4 interfaces? This could be caused by the DNS record order being flipped on different requests. If IPv6 comes first, your app will attempt to connect on that, and if the other side isn't listening on IPv6... well, timeout!

You can normally configure to listen on IPv6 (set host to ::) and most applications will tend to then listen on IPv4 too (i.e. 0.0.0.0).

If you can't make your application listen on both interfaces, then you can probably configure the other one to only send out on IPv4 (or 6, depending on what it's actually listening on), but I'm not familiar enough with NextJS to advise you on this.


thaumanovic

Can you ensure that your application is listening on both IPv6 and IPv4 interfaces? This could be caused by the DNS record order being flipped on different requests. If IPv6 comes first, your app will attempt to connect on that, and if the other side isn't listening on IPv6... well, timeout!You can normally configure to listen on IPv6 (set host to ::) and most applications will tend to then listen on IPv4 too (i.e. 0.0.0.0).If you can't make your application listen on both interfaces, then you can probably configure the other one to only send out on IPv4 (or 6, depending on what it's actually listening on), but I'm not familiar enough with NextJS to advise you on this.

michalkalita
HOBBYOP

a month ago

Oops, you are right, both FE and BE using default config to 0.0.0.0 , I don't check it before and don't have idea that ipv6 is not enabled by default.
I will change it to :: and check if same problem occurs again.

Thanks


Status changed to Awaiting User Response sam-a about 1 month ago


Status changed to Solved michalkalita 30 days ago


Loading...