Skip to content

fix(cli): retry processor upload on ECONNRESET and other transient network errors#72

Merged
philz3906 merged 1 commit into
mainfrom
dev/jupiterv2.10/fix-upload-retry-econnreset
Jun 19, 2026
Merged

fix(cli): retry processor upload on ECONNRESET and other transient network errors#72
philz3906 merged 1 commit into
mainfrom
dev/jupiterv2.10/fix-upload-retry-econnreset

Conversation

@jupiterv2

Copy link
Copy Markdown
Contributor

Problem

sentio upload fails intermittently at the final step that PUTs the packed
processor (dist/lib.js) to the signed storage URL, with:

FetchError: request to https://storage.googleapis.com/sentio-processors/upload/... failed, reason: socket hang up
  code: 'ECONNRESET'

Build / codegen / packaging all succeed and the signed URL is obtained fine —
only the upload PUT (via node-fetch) gets reset. The same PUT to the same GCS
host succeeds reliably via curl and via Node's built-in fetch (undici), so
the reset is a transient connection issue that node-fetch 2.x surfaces and
does not transparently retry.

Root cause

The retry guard in tryUploading only matched EPIPE:

if (e?.constructor.name === 'FetchError' && e.type === 'system' && e.code === 'EPIPE') {

ECONNRESET (the common one against GCS) fell through to the else branch and
aborted the whole upload after a single attempt — no retry — even though the
triedCount/backoff machinery was already in place for up to 5 tries.

Fix

Widen the retry whitelist to the common transient socket errnos
(ECONNRESET, ETIMEDOUT, ECONNREFUSED, EAI_AGAIN) in addition to EPIPE.
No behavior change for non-transient errors (they still surface immediately).

Test

Reproduced the ECONNRESET reliably (intermittent) with node-fetch 2.7.0
PUT-ing ~5MB to the GCS bucket host; undici and curl never reset. After the
change, a reset triggers the existing 1s-delay retry loop instead of aborting,
which is what lets the upload succeed on a subsequent attempt.

…rors

The upload step PUTs the packed processor to a signed storage URL via
node-fetch. node-fetch intermittently surfaces a "socket hang up"
(ECONNRESET) against GCS, but the retry guard only matched EPIPE, so a
single reset aborted the whole upload with no retry.

Widen the retry whitelist to cover the common transient socket errnos
(ECONNRESET, ETIMEDOUT, ECONNREFUSED, EAI_AGAIN) in addition to EPIPE.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@philz3906 philz3906 merged commit 2d8ed27 into main Jun 19, 2026
1 check passed
@philz3906 philz3906 deleted the dev/jupiterv2.10/fix-upload-retry-econnreset branch June 19, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants