Repository navigation
Description
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
- Run CLI on a network with DNS64/NAT64 (e.g., AWS Lambda in VPC with NAT gateway, or mobile carrier network)
- Execute any CLI command requiring API access:
testsprite project list - Observe: all retry attempts fail with
TRANSPORT/ETIMEDOUTon IPv6 addresses - Compare with
curlwhich 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: 4to 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
OkeyAmy commentedon Oct 13, 2026
/assign
testsprite-hob commentedon Oct 13, 2026
Thanks for the interest, @OkeyAmy! This issue hasn't been accepted for implementation yet — see the triage comment (a maintainer will label it
acceptedonce it is). Feel free to check back, or ping us on Discord if it's been quiet.fyZhang66 commentedon Oct 20, 2026
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.comhas 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; forcingfamily: 4in 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 thenNODE_OPTIONS=--dns-result-order=ipv4firstis the workaround. Closing here.OkeyAmy commentedon Oct 20, 2026
That correction makes sense, and it explains the timing I saw. I’ll run with
NODE_OPTIONS=--dns-result-order=ipv4firstuntil the API goes dual-stack, and keep an eye on the changelog.