Skip to content

Replace @knocklabs/client axios transport with fetch#1010

Draft
cjbell wants to merge 3 commits into
mainfrom
cjbell-replace-axios-fetch-3b83
Draft

Replace @knocklabs/client axios transport with fetch#1010
cjbell wants to merge 3 commits into
mainfrom
cjbell-replace-axios-fetch-3b83

Conversation

@cjbell
Copy link
Copy Markdown
Contributor

@cjbell cjbell commented Jun 5, 2026

Description

Replace the internal @knocklabs/client HTTP transport from axios/axios-retry to native fetch while preserving the existing makeRequest({ method, url, params, data }) call shape. This also removes the axios dependencies from the client package and adds a patch changeset.

Follow-up review hardening adds a guarded fetch resolver with an actionable no-fetch error, explicit fetch network error classification, and regression coverage for abort/no-fetch/retry-exhaustion edge cases.

Todos

  • Run focused client tests, typecheck, lint, and build.

Checklist

  • Tests have been added for new features or major refactors to existing features.

Screenshots or videos

Not relevant for this non-UI SDK transport change.

Validation

  • yarn test packages/client/test/api.test.ts — 28 passed
  • yarn test packages/client/test — 19 files / 549 tests passed
  • yarn workspace @knocklabs/client type:check — passed
  • yarn workspace @knocklabs/client lint — passed
  • yarn workspace @knocklabs/client build — passed

Linear Issue: KNO-12329

Open in Web Open in Cursor 

Co-authored-by: Chris Bell <chris@cjbell.co>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 5, 2026

🦋 Changeset detected

Latest commit: ed8b4dc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@knocklabs/client Patch

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

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
javascript-ms-teams-connect-example Ready Ready Preview, Comment Jun 5, 2026 6:57pm
javascript-nextjs-example Ready Ready Preview, Comment Jun 5, 2026 6:57pm
javascript-slack-connect-example Ready Ready Preview, Comment Jun 5, 2026 6:57pm
javascript-slack-kit-example Ready Ready Preview, Comment Jun 5, 2026 6:57pm

Request Review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f88dfad. Configure here.

Comment thread packages/client/src/api.ts Outdated
// Retry Network Errors.
if (axiosRetry.isNetworkError(error)) {
private canRetryRequest(error: unknown) {
if (error instanceof TypeError) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TypeError retry too broad

Medium Severity

canRetryRequest treats every TypeError as retriable, but requestWithRetries wraps buildUrl, buildRequestInit, and fetch in the same try/catch. Invalid URLs, bad params, or non-JSON-serializable data throw TypeError before any network I/O and still get up to three extra attempts with backoff.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f88dfad. Configure here.

Co-authored-by: Chris Bell <chris@cjbell.co>
Co-authored-by: Chris Bell <chris@cjbell.co>
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2026

Codecov Report

❌ Patch coverage is 90.95745% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.95%. Comparing base (7ef0f23) to head (ed8b4dc).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/client/src/api.ts 90.95% 17 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1010      +/-   ##
==========================================
+ Coverage   63.55%   63.95%   +0.40%     
==========================================
  Files         208      208              
  Lines        9924    10082     +158     
  Branches     1280     1338      +58     
==========================================
+ Hits         6307     6448     +141     
- Misses       3592     3609      +17     
  Partials       25       25              
Files with missing lines Coverage Δ
packages/client/src/api.ts 92.74% <90.95%> (-5.33%) ⬇️

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