Acl 2909 retry on econnreset#79
Closed
dfenster wants to merge 4 commits intoDeepLcom:mainfrom
Closed
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three changes, bundled because they all need to land together to keep CI clean:
Expand retry allowlist (
src/client.ts) —HttpClient.shouldRetrynow treatsECONNRESET,EPIPE, andEAI_AGAINas retryable in addition to the existingETIMEDOUTand
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 firstattempt. Behavior now aligns with deepl-python, which retries any
requests.exceptions.ConnectionError. Refs ACL-2909.Drop
uuiddependency in favor ofcrypto.randomUUID()— resolves GHSA-w5hq-g745-h8pq (uuid <14.0.0) which wasfailing
npm audit --production. The codebase only usedv4()(random UUIDs), whichcrypto.randomUUID()covers natively. Avoids the ESM/CommonJS pain that comes withuuid>= 14.Bump
engines.nodefrom>=12.0to>=14.17— Node 12 has been EOL since April 2022, andcrypto.randomUUID()is available from Node 14.17 onward.Version:
1.26.0→1.27.0.