Repository navigation
Conversation
…id-download The download ran inside an async Promise executor that awaited the hash promises. A rejection there (e.g. ECONNRESET aborting the response stream mid-download) never reached `reject` and became an unhandled rejection, crashing the process before p-retry could retry. Route hash failures through `reject` instead, so the error reaches p-retry and the download is retried as RETRIES_COUNT intends. Fixes prisma#31364
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Fixes #31364
Summary
downloadZipran the download inside anasyncPromise executor thatawaited the hash promises. When the response stream aborted mid-download(e.g.
ECONNRESET),hasha.fromStreamrejected inside that executor, sothe rejection never reached
rejectand became an unhandled rejection.Node terminated the process on the first attempt, before p-retry could
retry, and before the postinstall's
.catch()could swallow it — evenwith
failSilent: true.This removes the
asyncexecutor and routes hash failures throughrejectviaPromise.all(...).then(..., reject), so the error reachesp-retry and the download is retried as
RETRIES_COUNTintends. If allretries fail, the error now propagates normally instead of crashing the
process.
Test plan
packages/fetch-engine/src/__tests__/downloadZip.test.tswith amocked
node-fetch(no network): a happy-path download with real gzipECONNRESETcase assertingthe promise rejects and the engine URL is fetched 3 times (1 + 2 retries).
pnpm --filter @prisma/fetch-engineequivalent run locally via vitest:2 passed. Against the old code the same test reports 3 unhandled
rejections (
ECONNRESET,attemptNumber: 3), reproducing@prisma/enginespostinstall crashes on ECONNRESET instead of retrying (unhandled rejection indownloadZip) #31364.eslintclean on both changed files. Fulldownload.test.tssuite notrun locally (downloads real engines from the network); CI to cover.
Summary by CodeRabbit
Bug Fixes
Tests