Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- summary: |
Fix remote generation CLI hanging indefinitely when S3 download stalls.
Added connection timeout (60s) and overall download timeout (5 min) to
both downloadZipForTask and downloadAndExtractZipToDirectory, so the CLI
fails with a clear error instead of blocking forever.
type: fix
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,9 @@ async function downloadFilesForTask({
}
}

/** Maximum time (ms) to wait for the S3 download to complete, including streaming. */
const S3_DOWNLOAD_TIMEOUT_MS = 5 * 60 * 1_000;

async function downloadZipForTask({
s3PreSignedReadUrl,
absolutePathToLocalOutput
Expand All @@ -489,7 +492,9 @@ async function downloadZipForTask({
}): Promise<void> {
// initiate request
const request = await axios.get(s3PreSignedReadUrl, {
responseType: "stream"
responseType: "stream",
timeout: 60_000,
signal: AbortSignal.timeout(S3_DOWNLOAD_TIMEOUT_MS)
});

// pipe to zip
Expand Down Expand Up @@ -655,7 +660,9 @@ async function downloadAndExtractZipToDirectory({
outputPath: AbsoluteFilePath;
}): Promise<void> {
const request = await axios.get(s3PreSignedReadUrl, {
responseType: "stream"
responseType: "stream",
timeout: 60_000,
signal: AbortSignal.timeout(S3_DOWNLOAD_TIMEOUT_MS)
});

const tmpDir = await tmp.dir({ prefix: "fern", unsafeCleanup: true });
Expand Down