Replace @knocklabs/client axios transport with fetch#1010
Conversation
🦋 Changeset detectedLatest commit: eb1b42b The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
394b56a to
0916d4c
Compare
0916d4c to
3d31bc4
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3d31bc4. Configure here.
Co-authored-by: Chris Bell <chris@cjbell.co>
Co-authored-by: Chris Bell <chris@cjbell.co>
Co-authored-by: Chris Bell <chris@cjbell.co>
…ias, drop dead eslint directive, document retry loop)
Addresses Cursor BugBot "Unread bodies on HTTP retries". On retryable 5xx/429 responses the retry loop read a clone and left the original Response body undrained. The response is discarded before the next attempt, so read it directly (no clone), which drains the body and releases the connection. Also updates the retry-exhaustion test to return a fresh Response per call, matching real fetch semantics where a body can only be consumed once.
…s, not axios code
The connection-status hooks classified a not-yet-connected tenant by
reading the axios error code ("ERR_BAD_REQUEST"). The new fetch
transport returns an ApiRequestError with no code field, so that branch
died and unconnected tenants rendered as a connection "error" instead
of "disconnected". Key off response.status (4xx) instead, which both
the old and new transports provide. Adds regression tests for the
not-set path (previously uncovered) and updates AuthCheckResult to drop
the axios-only code field and expose response.status.
axios-retry's exponentialDelay used Math.max(backoff, retryAfter(error)) and added up to 20% jitter. The fetch port used a fixed exponential backoff and dropped both, so a 429/503 carrying Retry-After was retried on the short backoff (exhausting retries in ~1.4s) instead of waiting the server-specified window. Parse Retry-After (seconds or HTTP date) and take the max with the jittered backoff, restoring the old behavior.
6f49b96 to
84ac998
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1010 +/- ##
==========================================
+ Coverage 63.95% 64.46% +0.51%
==========================================
Files 212 212
Lines 10028 10211 +183
Branches 1321 1389 +68
==========================================
+ Hits 6413 6583 +170
- Misses 3590 3603 +13
Partials 25 25
|

Description
Replace the internal
@knocklabs/clientHTTP transport from axios/axios-retry with nativefetch, preserving themakeRequest({ method, url, params, data })call shape and removing the axios dependencies.Transport rewrite:
fetch.Retry-Afterhandling, and theerror.response.status/error.response.datashape that consumers read.fetchexists.Consumer regressions the migration would have introduced, caught in review and fixed here:
@knocklabs/react-corehooks keyed off the axios-onlyerror.code. They now readresponse.status, andAuthCheckResultno longer exposescode, exposingresponse.statusinstead.Retry-Afteron 429 and 503 responses was no longer honored (axios-retry respected it). Restored, along with retry-delay jitter.Also in this PR:
@knocklabs/clientand@knocklabs/react-core, both patch.Checklist
Screenshots or videos
N/A. Non-UI SDK change.
Validation
@knocklabs/clientapi.test.tsandapi.characterization.test.ts, plus the@knocklabs/react-coreSlack and MS Teams connection-status hook tests, pass.main;yarn.lockvalidated withyarn install --mode=update-lockfile(no drift).Linear Issue: KNO-12329