next.js
7ece5e6e - test: retry vercel deploy on transient pre-deployment network errors (#100070)

Commit
11 days ago
test: retry vercel deploy on transient pre-deployment network errors (#100070) ## Summary This retries `vercel deploy` when it fails with a transient network error before the CLI reports a deployment. It is the third of three stacked PRs. **Why.** On v16.5.0-canary.6 attempt 1 ([example](https://github.com/vercel/next.js/actions/runs/37957356976/job/113914293394)), `vercel deploy` printed `Error: fetch failed` and no deployment URL. The harness failed straight away; the cause it reported was a misleading `Invalid URL`. **When it retries.** All of these must hold: - `vercel deploy` exits non-zero; - stdout isn't a URL, and the output (with ANSI codes stripped) has no `Inspect`/`Preview`/`Production` URL line; - the output has a CLI `Error:` line with a network failure: `fetch failed`, `ECONNRESET`, `ETIMEDOUT`, `EAI_AGAIN`, `ECONNREFUSED`, `UND_ERR_SOCKET`, `UND_ERR_CONNECT_TIMEOUT` or `socket hang up`; - the output doesn't contain an auth or build diagnostic (`Unauthorized`, `Forbidden`, `Build failed`, `Command "…" exited`, …). **Limits.** - At most 3 attempts in total, waiting 5 s and then 10 s between them. - It only retries while at least 60 s of the setup budget would remain after the wait. - Every other failure goes through the existing `throwDeploymentError` path unchanged, with no extra deploy. **Accepted risk.** If the connection drops after Vercel accepted the upload, a retry can leave an orphaned preview deployment (the harness deploys with `--force`). That's at most 2 extra previews per suite start in the test project. The retry log line says so and includes the CLI output. This PR also fixes a typo in a comment in `test/e2e/app-dir/resume-data-cache/resume-data-cache.test.ts`. That change is there so `Test new and changed tests when deployed` runs a deploy-mode suite against the full stack. ## Verification - `pnpm jest test/unit/next-deploy-failure`: 43/43 pass. - **Retries:** retry-then-succeed, giving up after 3 calls, and skipping the retry when too little budget is left. - **No retry (exactly one deploy):** auth error, build failure, a network error after a URL or an `Inspect` line (including ANSI-colored output), a build diagnostic that mentions `fetch failed`, and `Unauthorized` next to `fetch failed`. - prettier, eslint and `pnpm typescript` are clean. - Not run: a real Vercel deployment (the sandbox has no test credentials). <!-- NEXT_JS_LLM --> <!-- fleet b78d4bc5-dee1-4d80-b647-54229882f21f --> --------- Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
Author
Parents
Loading