Error: connect EHOSTUNREACH when sending requests to my fly.io app

Taking a look at this.

Looks like this is only failing on IPv6, we’re looking into fixing it.

2 Likes

Is there a way to force using ipv4?
So that we can still have the node app running if ipv6 encounters problems.

That’s on a per-application basis. I’m not sure what http library you’re using, but there might be a setting to only resolve IPv4.

We should get this sorted out soon though!

This should now be fixed!

1 Like

Seeing this error now from a cron job that checks in to dead man’s snitch:

FetchError: request to https://nosnch.in/627e6e9b5f failed, reason: connect ETIMEDOUT 2600:1f18:6523:6402:80dc:f32:54dd:21d1:443

Seeing ENETUNREACH intermittently - also on Node. Can’t determine if there’s way to force Node to resolve via ipv4 in the meantime.

Seeing this specifically in mia, which I will rotate out of for now.

2023-01-12T22:05:58Z app[be8e98c7] mia [info]TypeError: fetch failed
2023-01-12T22:05:58Z app[be8e98c7] mia [info]    at Object.fetch (node:internal/deps/undici/undici:11118:11)
2023-01-12T22:05:58Z app[be8e98c7] mia [info]    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-01-12T22:05:58Z app[be8e98c7] mia [info]    at async handler (/app/apps/myflexpa/.next/server/pages/api/exchange.js:20:20)
2023-01-12T22:05:58Z app[be8e98c7] mia [info]    at async Object.apiResolver (/app/node_modules/next/dist/server/api-utils/node.js:367:9)
2023-01-12T22:05:58Z app[be8e98c7] mia [info]    at async NextNodeServer.runApi (/app/node_modules/next/dist/server/next-server.js:474:9)
2023-01-12T22:05:58Z app[be8e98c7] mia [info]    at async Object.fn (/app/node_modules/next/dist/server/next-server.js:736:37)
2023-01-12T22:05:58Z app[be8e98c7] mia [info]    at async Router.execute (/app/node_modules/next/dist/server/router.js:252:36)
2023-01-12T22:05:58Z app[be8e98c7] mia [info]    at async NextNodeServer.run (/app/node_modules/next/dist/server/base-server.js:384:29)
2023-01-12T22:05:58Z app[be8e98c7] mia [info]    at async NextNodeServer.handleRequest (/app/node_modules/next/dist/server/base-server.js:322:20)
2023-01-12T22:05:58Z app[be8e98c7] mia [info]    at async Server.<anonymous> (/app/apps/myflexpa/server.js:19:5) {
2023-01-12T22:05:58Z app[be8e98c7] mia [info]  cause: Error: connect ENETUNREACH 2a09:8280:1::1:3b5c:443
2023-01-12T22:05:58Z app[be8e98c7] mia [info]      at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1300:16) {
2023-01-12T22:05:58Z app[be8e98c7] mia [info]    errno: -101,
2023-01-12T22:05:58Z app[be8e98c7] mia [info]    code: 'ENETUNREACH',
2023-01-12T22:05:58Z app[be8e98c7] mia [info]    syscall: 'connect',
2023-01-12T22:05:58Z app[be8e98c7] mia [info]    address: '2a09:8280:1::1:3b5c',
2023-01-12T22:05:58Z app[be8e98c7] mia [info]    port: 443
2023-01-12T22:05:58Z app[be8e98c7] mia [info]  }
1 Like

Seeing this again on another application also deployed to mia:

2023-01-19T00:11:56Z app[4163e06e] mia [info]Error: connect ENETUNREACH 2a09:8280:1::1:3b5c:443
2023-01-19T00:11:56Z app[4163e06e] mia [info]    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1300:16) {
2023-01-19T00:11:56Z app[4163e06e] mia [info]  errno: -101,
2023-01-19T00:11:56Z app[4163e06e] mia [info]  code: 'ENETUNREACH',
2023-01-19T00:11:56Z app[4163e06e] mia [info]  syscall: 'connect',
2023-01-19T00:11:56Z app[4163e06e] mia [info]  address: '2a09:8280:1::1:3b5c',
2023-01-19T00:11:56Z app[4163e06e] mia [info]  port: 443
2023-01-19T00:11:56Z app[4163e06e] mia [info]}

Sending requests to my fly.io app stopped today with this error:

HTTP Error: Error: connect ENETUNREACH 2a09:8280:1::5b:497:443 - Local (:::0)

Based on other comments, this might be specific to the host i’m deployed to? Is there anything I can do?

It looks like your app doesn’t have an IPv4 address. This error can occur when you try to connect over IPv4 (i.e. because your ISP doesn’t support IPv6).

You can tell by going to https://ipv6-test.com/ or trying:

āÆ curl -v ipv6.google.com             
*   Trying [2607:f8b0:4006:80b::200e]:80...
* Immediate connect fail for 2607:f8b0:4006:80b::200e: Network is unreachable
* Failed to connect to ipv6.google.com port 80 after 120 ms: Couldn't connect to server
* Closing connection 0
curl: (7) Failed to connect to ipv6.google.com port 80 after 120 ms: Couldn't connect to server

The solution is to allocate an IPv4 address. This should give you a free shared address:

fly ips allocate-v4 --shared

Thanks @ben-io. I think allocate command means I get a dedicated IPv4 and I didn’t need that. But I did add in the shared IPv4 to my DNS settings. It’s now working, thank you.

1 Like

I started to experience the same error Error: connect ENETUNREACH while trying to send POST request from App A (v1) to App B (v2).

App B is online and it works fine as I’m able to send any request via POSTMAN. Any ideas?
Both apps have IPv4 (shared) and IPv6 assigned.

I also started to experience this error randomly occuring during requests from one fly app to another. Same requests for same urls sometimes goes through and sometimes not.
fly ips allocate-v4 --shared
did not help

Hey! Suddenly getting this error too :slight_smile:

All my DNS settings are correct so not sure what is happening or what I can do to resolve this on my end.

Error: connect ENETUNREACH 2a09:8280:1::6:d178:443

Any help?