aws-amplify / aws-amplify/amplify-cli

Amplify CLI v14.2.5 IPv6/IPv4 connectivity timeout with Node.js v18 Happy Eyeballs

Open
#14,613 1 comment 0 reactions 0 assignees View on GitHub
bug p2
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### How did you install the Amplify CLI?

_No response_

### If applicable, what version of Node.js are you using?

v18.20.2

### Amplify CLI Version

14.2.5

### What operating system are you using?

Ubunuta

### Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No manual changes made

### Describe the bug

I've had a hard time publishing to ap-southeast-2. The push would work but the front-end wouldn't deploy.

```
Deployed hosting amplifyhosting [ ======================================== ] 1/1

✔ Generated GraphQL operations successfully and saved at src/graphql
🛑

Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

Session Identifier: 0010809c-3333-2222-1111-b64667c2f7b8
```
Claude dug into the logs, and eventually found out the root cause below and offered the workaround, which also worked.

The specific error: ETIMEDOUT when connecting to AWS Cognito
Root cause analysis: Node.js v18's internalConnectMultiple resolves both A and AAAA records via c-ares, bypassing gai.conf, causing simultaneous IPv4/IPv6 connection attempts that timeout when IPv6 routes are unavailable
Current workaround: Adding hardcoded IP entry to hosts file (54.79.94.125)
Caveat: AWS rotates NLB IPs over time, making this a temporary solution
Suggested long-term fix: Upgrade Amplify CLI to respect generateAppClientSecret: false and skip the DescribeUserPoolClient call entirely

### Expected behavior

Successful deployment

### Reproduction steps

A new env which uses Cognito
Use Amplify CLI v14.2.5 on a system with IPv6 configured but no IPv6 routing
Run amplify publish command
Observe ETIMEDOUT errors when connecting to AWS Cognito endpoints

### Project Identifier

_No response_

### Log output

```
# Put your logs below this line

```

### Additional information

Network Configuration Impact:

The issue occurs when systems have IPv6 configured but no actual IPv6 routing
c-ares library bypasses system gai.conf configuration
Both IPv4 and IPv6 SYN packets are sent simultaneously, causing timeouts

Expected vs Actual Behavior:

Expected: CLI should fall back to IPv4 when IPv6 is unavailable
Actual: Both connection attempts timeout simultaneously

### Before submitting, please confirm:

- [x] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [x] I have removed any sensitive information from my code snippets and submission.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `amplify publish` with CLI v14.2.5, Node.js v18.20.2, Cognito, and IPv6 configured without IPv6 routing. Inspect the Cognito connection path around the `DescribeUserPoolClient` call and `generateAppClientSecret: false`; done means deployment succeeds without ETIMEDOUT and IPv4 fallback works without hardcoded rotating IPs.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, node.js, typescript
Domain
authentication, cli, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.