You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: always pass an explicit HTTP agent to avoid Node's 5s idle timeout (cut 1.1.110) (#1344)
* fix(sdk): always pass an explicit HTTP agent to avoid Node's 5s idle timeout
Node >=19's global HTTP/HTTPS agent enables keepAlive with a 5s socket
timeout, which Node applies as a per-socket inactivity timeout. setupSdk
only supplied an explicit agent for the proxy and SSL_CERT_FILE cases, so
the common path inherited the global agent's 5s timeout even when
SOCKET_CLI_API_TIMEOUT is unset.
This caused upload-manifest-files to fail intermittently: the SDK streams
the multipart body with Transfer-Encoding: chunked, and when the server
takes >5s to parse auth/multipart before sending any response byte, the
socket goes idle, Node fires the 5s timeout, and the SDK destroys the
request, so the client disconnects before receiving any response.
Always pass a fresh Agent (no timeout) so a request is bounded only by an
explicit SOCKET_CLI_API_TIMEOUT or until interrupted. Reproduced locally
against a slow mock server with no load balancer in the path.
* fix(api): use an explicit agent for the raw apiFetch stack; cut 1.1.110
apiFetch's https.request used the default (global) agent when no CA cert
was configured, inheriting Node >=19's keepAlive 5s socket timeout — the
same issue just fixed for the SDK. getHttpsAgent now always returns an
explicit HttpsAgent (no timeout), covering queryApiSafe*/sendApiRequest
and the direct apiFetch download paths (streaming full-scan responses,
binary and tarball downloads).
Bumps the version to 1.1.110 and adds the changelog entry.
* refactor(api): tighten getHttpsAgent return type to HttpsAgent
getHttpsAgent now always creates an agent on first call, so its return
type is HttpsAgent (was HttpsAgent | undefined) and the _httpsRequestFetch
agent parameter drops | undefined. The cached _httpsAgent keeps | undefined
since it is the lazy-init sentinel (undefined only before the first call).
The _httpsAgentResolved flag is removed: a set _httpsAgent is itself the
"resolved" signal. Pure polish from review; no behavior change.
- Resolved intermittent ~5-second timeouts affecting manifest uploads for reachability analysis and `socket fix`, along with other long-running API requests. Socket CLI now uses an explicit HTTP agent for all API traffic, so slow uploads and large streaming responses are no longer dropped prematurely.
0 commit comments