From 10afac931140b47f52c02641e214e4867dcb61a7 Mon Sep 17 00:00:00 2001 From: Shrinish Vhanbatte Date: Thu, 16 Apr 2026 16:36:16 +0530 Subject: [PATCH] TE-12436: fix screenshot upload ECONNRESET for payloads over 2MB Screenshots larger than ~2MB failed with "socket hang up" because form-data defaults maxDataSize to 2MB and the /screenshot request did not override axios maxBodyLength/maxContentLength. CombinedStream aborted mid-upload, the server saw a truncated body, and the TCP connection was reset. Set form.maxDataSize = Infinity and pass maxBodyLength/maxContentLength = Infinity on the axios request, matching the other upload paths in this file. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/lib/httpClient.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/httpClient.ts b/src/lib/httpClient.ts index 0b3176a6..a2d36144 100644 --- a/src/lib/httpClient.ts +++ b/src/lib/httpClient.ts @@ -330,6 +330,8 @@ export default class httpClient { browserName = browserName === constants.SAFARI ? constants.WEBKIT : browserName; const file = fs.readFileSync(ssPath); const form = new FormData(); + // form-data defaults maxDataSize to 2MB; disable to allow large screenshots + (form as any).maxDataSize = Infinity; form.append('screenshot', file, { filename: `${ssName}.png`, contentType: 'image/png' }); form.append('browser', browserName); form.append('viewport', viewport); @@ -343,7 +345,9 @@ export default class httpClient { method: 'POST', headers: form.getHeaders(), data: form, - timeout: 30000 + timeout: 30000, + maxBodyLength: Infinity, // prevent axios from limiting the body size + maxContentLength: Infinity, // prevent axios from limiting the content size }) .then(() => { log.debug(`${ssName} for ${browserName} ${viewport} uploaded successfully`);