Skip to content

CLI fails on DNS64/NAT64 networks — IPv6 fallback broken #390

Closed as not planned

Description

@OkeyAmy

The CLI is completely unusable on networks with DNS64/NAT64 (AWS VPC with NAT gateway, mobile carriers, IPv6-only environments). The underlying HTTP client (undici) attempts IPv6 addresses first, which time out, and fails to properly fall back to IPv4 addresses.

Root Cause
Node.js's global fetch (undici) resolves api.testsprite.com to both IPv6 and IPv4 addresses. On DNS64/NAT64 networks, the IPv6 addresses are synthesized and route through a NAT64 translator that doesn't actually reach the destination. Undici tries all IPv6 addresses first (4 retry attempts × ~500ms each = ~2s total) before ever trying IPv4, and the CLI surfaces 'Service temporarily unavailable' without ever attempting the working IPv4 path.

Reproduction Steps

  1. Run CLI on a network with DNS64/NAT64 (e.g., AWS Lambda in VPC with NAT gateway, or mobile carrier network)
  2. Execute any CLI command requiring API access: testsprite project list
  3. Observe: all retry attempts fail with TRANSPORT / ETIMEDOUT on IPv6 addresses
  4. Compare with curl which works (tries IPv6 → fails → falls back to IPv4)

Evidence

[debug] {"kind":"request","method":"GET","url":"https://api.testsprite.com/api/cli/v1/projects?pageSize=25","attempt":1,"requestId":"cli_c29c454a-b3fa-441d-85a6-6893304019b5"}
[debug] {"kind":"error","method":"GET","url":"https://api.testsprite.com/api/cli/v1/projects?pageSize=25","attempt":1,"errorCode":"TRANSPORT","durationMs":10521}
[debug] {"kind":"retry","method":"GET","url":"https://api.testsprite.com/api/cli/v1/projects?pageSize=25","attempt":1,"errorCode":"TRANSPORT","delayMs":297}
... (repeats for 4 attempts, all on IPv6)

Expected Behavior
CLI should either:

  • Force IPv4 resolution (respect --dns-result-order=ipv4first)
  • Configure undici Agent with family: 4 to skip IPv6 entirely
  • Implement proper Happy Eyeballs fallback (try IPv4 after brief IPv6 timeout)

Actual Behavior
CLI fails with 'Service temporarily unavailable' after 4 IPv6 retry attempts (~2s). No IPv4 fallback attempted.

Suggested Fix
In src/lib/client-factory.ts, configure the undici Agent with IPv4-only or Happy Eyeballs:

const agent = new undici.Agent({
  connect: { family: 4 }  // Force IPv4
});
// Or for proper Happy Eyeballs:
const agent = new undici.Agent({
  connect: { family: 0, timeout: 100 }  // Dual-stack with short IPv6 timeout
});

Discord: okey_amy

Activity

  1. OkeyAmy commented on Oct 13, 2026

    @OkeyAmy
    ContributorAuthor

    /assign

  2. testsprite-hob commented on Oct 13, 2026

    @testsprite-hob

    Thanks for the interest, @OkeyAmy! This issue hasn't been accepted for implementation yet — see the triage comment (a maintainer will label it accepted once it is). Feel free to check back, or ping us on Discord if it's been quiet.

  3. fyZhang66 commented on Oct 20, 2026

    @fyZhang66
    Contributor

    Thanks for the thorough log. Two findings on our side: Node 20.19+ already defaults to Happy Eyeballs, and the 10.5 s in your debug output is undici's overall connect timeout rather than IPv4 never being tried, so the stated cause does not match the code. More to the point, the root cause is ours: api.testsprite.com has no IPv6 address (A record only), which is why DNS64/NAT64 networks have to synthesize one. The right fix is to make the API dual-stack, which is an infrastructure change on our side, not a CLI one; forcing family: 4 in the CLI would break IPv6-only hosts. We're tracking the dual-stack work internally and will mention it in the changelog when it lands. Until then NODE_OPTIONS=--dns-result-order=ipv4first is the workaround. Closing here.

  4. added
    wontfix
    on Oct 20, 2026
  5. OkeyAmy commented on Oct 20, 2026

    @OkeyAmy
    ContributorAuthor

    That correction makes sense, and it explains the timing I saw. I’ll run with NODE_OPTIONS=--dns-result-order=ipv4first until the API goes dual-stack, and keep an eye on the changelog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions