Conversation
axios <1.8 does not set a top-level `status` on the error object — the HTTP
status lives at `e.response.status`. `getWorkerRegistrationStatus` gated its
404 handling on `e.status === 404`, which is always `undefined` with the pinned
`axios@1.7.9`, so both branches were dead:
- a not-yet-registered worker (404 `WorkerNotFoundException`) was classified as
`ERROR` instead of `NOT_EXISTS`, so `registerWorker` never calls
`storeWorkerInRegistry` and retries forever (`{ forever: true }`);
- the empty-body 404 "invalid path" branch was also unreachable.
Also guard the `e.response.data` reads in the `.catch` handlers of
`getWorkerRegistrationStatus`, `storeWorkerInRegistry` and `obtainTokenFromAuthServer`:
on a network-level error `e.response` is undefined, so `e.response.data` throws a
`TypeError` from inside the catch and masks the original failure. Matches the
existing `e.response?.status` usage in util/base-urls.ts.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #51
What
getWorkerRegistrationStatus()insrc/auth/registry.tsbranches one.status,but
axios@1.7.9(pinned) puts the HTTP status one.response.status— thetop-level
e.statusalias was only added in axios1.8.0. Soe.status === 404is always
falseand both 404 branches are unreachable:404 WorkerNotFoundExceptionreturnsERRORinstead of
NOT_EXISTS, soregisterWorker()never reachesstoreWorkerInRegistry()and loops forever underpromiseRetry({ forever: true });Change
status/datafrome.response?.…in thegetWorkerRegistrationStatus.catch, so theNOT_EXISTSand "invalid path" branches work again.logger.error(e.data)→logger.error(data)(was always loggingundefined).e.response.datareads in the.catchhandlers ofstoreWorkerInRegistryandobtainTokenFromAuthServer(src/auth/login.ts) —on a network-level error
e.responseisundefinedande.response.datathrows a
TypeErrorfrom inside the catch, masking the real error.Matches the existing
e.response?.statuspattern insrc/util/base-urls.ts.Notes
Behaviour-only fix, 2 files. The repo has no test suite (
npm testis a stub), sothis is covered by inspection. Verified
prettier --checkpasses on both files.🤖 Generated with Claude Code