Skip to content

Fix/node version guard and fetch error unwrap#187

Closed
riley0227 wants to merge 2 commits intomainfrom
fix/node-version-guard-and-fetch-error-unwrap
Closed

Fix/node version guard and fetch error unwrap#187
riley0227 wants to merge 2 commits intomainfrom
fix/node-version-guard-and-fetch-error-unwrap

Conversation

@riley0227
Copy link
Copy Markdown
Contributor

Summary

What does this PR change?

Type

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Test
  • CI

Changes

Validation

How did you test this?

Checklist

  • Tests pass
  • Smoke tests pass
  • No raw errors introduced
  • CLI output follows Ix format

…causes

Users on Node 18 hit a bare "fetch failed" during ix map with no hint at
the underlying cause. Root causes: (1) no engines field or runtime check,
so install and startup succeed silently on EOL Node, and (2) ix map's
error handler printed err.message, discarding the real transport error
that undici stashes in err.cause.

- Add engines.node >=20 to ix-cli/package.json
- Add runtime Node major-version guard in ix-cli/src/cli/main.ts that
  exits early with an actionable message on Node <20
- Add formatFetchError in ix-cli/src/cli/errors.ts that unwraps err.cause
  for fetch TypeErrors, exposing codes like ECONNRESET / UND_ERR_SOCKET
- Use formatFetchError at both error sites in ix-cli/src/cli/commands/map.ts
- Document Node 20+ in README Requirements section
Node 18's bundled undici 5.x has a 300s headersTimeout default that
silently kills long-running fetch calls like /v1/map, causing the
reported "fetch failed" with no actionable detail. Node 20's undici 6.x
fixed this. Node 18 is also EOL as of April 2025.

The runtime guard in main.ts already enforces >=20, but the install
scripts, build script, setup script, and requirements.txt still allowed
18 — meaning users could install successfully on Node 18 only to hit
a cryptic failure at runtime.

Updated:
- scripts/install/install.sh (NODE_MIN_MAJOR)
- scripts/install/install.ps1 ($NodeMinMajor)
- scripts/build-cli.sh (version check + error message)
- scripts/dev/setup.sh (hint text)
- requirements.txt (node>=20, comment)
@riley0227 riley0227 closed this Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant