next.js
20753831 - Fix ENOBUFS errors in pr-status.js when fetching large CI logs (#90654)

Commit
24 days ago
Fix ENOBUFS errors in pr-status.js when fetching large CI logs (#90654) ## Summary Fixes `spawnSync /bin/sh ENOBUFS` errors in `scripts/pr-status.js` when fetching large CI job logs. The script uses `execSync` (which internally uses `spawnSync`) to fetch CI job logs via `gh api .../jobs/{id}/logs`. `execSync` has a hard `maxBuffer` limit (set to 50MB), and when CI job logs exceed that size, Node.js throws an `ENOBUFS` error. This causes the flaky test detection to silently fail, reporting 0 flaky tests. **Before:** ``` Fetching logs for 37 failed jobs... [stderr] Command failed: gh api "repos/vercel/next.js/actions/jobs/65135029618/logs" spawnSync /bin/sh ENOBUFS [stderr] Command failed: gh api "repos/vercel/next.js/actions/jobs/65135029722/logs" spawnSync /bin/sh ENOBUFS Found 0 flaky tests (failing on 2+ different branches) ``` **After:** ``` Fetching logs for 18 failed jobs... Found 0 flaky tests (failing on 2+ different branches) ``` ## Changes - Added an `execAsync()` helper that uses `child_process.spawn` instead of `execSync`. `spawn` streams data through pipes with no built-in buffer limit, avoiding `ENOBUFS` entirely. - Updated `getJobLogs()` and the log-fetching loop in `getFlakyTests()` to use `execAsync` instead of `exec`. - All other API calls (small JSON responses) continue using the synchronous `exec()` helper since they are well within the 50MB limit. ## Test Plan Ran `node scripts/pr-status.js 90617` against a PR with multiple failed jobs — completes successfully with no ENOBUFS errors.
Author
Parents
Loading