Skip to content

Acl 2909 retry on econnreset#79

Closed
dfenster wants to merge 4 commits intoDeepLcom:mainfrom
dfenster:acl-2909-retry-on-econnreset
Closed

Acl 2909 retry on econnreset#79
dfenster wants to merge 4 commits intoDeepLcom:mainfrom
dfenster:acl-2909-retry-on-econnreset

Conversation

@dfenster
Copy link
Copy Markdown
Contributor

Three changes, bundled because they all need to land together to keep CI clean:

  1. Expand retry allowlist (src/client.ts)HttpClient.shouldRetry now treats ECONNRESET, EPIPE, and EAI_AGAIN as retryable in addition to the existing ETIMEDOUT
    and ECONNABORTED. Previously these transient transport-level failures (e.g. stale keep-alive sockets reused after the LB closed them) bubbled up as hard errors on the first
    attempt. Behavior now aligns with deepl-python, which retries any requests.exceptions.ConnectionError. Refs ACL-2909.

  2. Drop uuid dependency in favor of crypto.randomUUID() — resolves GHSA-w5hq-g745-h8pq (uuid <14.0.0) which was
    failing npm audit --production. The codebase only used v4() (random UUIDs), which crypto.randomUUID() covers natively. Avoids the ESM/CommonJS pain that comes with uuid >= 14.

  3. Bump engines.node from >=12.0 to >=14.17 — Node 12 has been EOL since April 2022, and crypto.randomUUID() is available from Node 14.17 onward.

Version: 1.26.01.27.0.

Expands HttpClient's retryable axios error code allowlist so transient
transport failures (TCP RST mid-flight, broken pipe, transient DNS) are
retried instead of bubbling up as hard errors on the first attempt.

Aligns deepl-node behavior with deepl-python, which retries any
requests.exceptions.ConnectionError.

Motivating failure mode: parallel /v2/translate calls failing with
ECONNRESET ("socket hang up") when reusing a stale keep-alive socket.
The SDK previously classified all such errors as non-retryable and
surfaced them to the caller; with this change the SDK retries with
fresh connections.

The retryable-codes set is exported as @internal so the contract is
testable; ECONNREFUSED, ENOTFOUND, and CERT_HAS_EXPIRED remain non-
retryable.
Replaces `uuid` (v8) with Node's built-in `crypto.randomUUID()`, available
since Node 14.17 / 15.6. The codebase only used `v4()` (random UUIDs),
which `crypto.randomUUID()` covers natively.

Motivation:
- npm audit flags `uuid <14.0.0` (GHSA-w5hq-g745-h8pq), blocking CI's
  `npm audit --production` step.
- The CVE only affects `v3/v5/v6` with a `buf` parameter; this codebase
  was never affected at runtime, but the audit gate still failed.
- `uuid >= 14` is pure ESM and breaks the existing ts-jest CommonJS
  setup. Dropping the dependency entirely sidesteps both issues.

Bumps `engines.node` from `>=12.0` to `>=14.17`. Node 12 reached end of
life in April 2022; this aligns the engines field with reality.

Touched:
- src/documentMinifier.ts: `uuidv4()` -> `randomUUID()`
- tests/core.ts, tests/glossary.test.ts, tests/multilingualGlossary.test.ts,
  tests/documentMinification/helperMethods.test.ts: same swap
- package.json: removes `uuid` and `@types/uuid`, bumps engines.node
@dfenster dfenster closed this by deleting the head repository Apr 27, 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