Skip to content

Conversation

@tylerbutler
Copy link
Member

@tylerbutler tylerbutler commented Oct 1, 2025

Summary

Replaces the axios HTTP client library with native fetch API across client-side packages to reduce bundle size and simplify dependencies.

Changes

Routerlicious Driver (packages/drivers/routerlicious-driver)

  • Replaced axios with native fetch via cross-fetch polyfill
  • Created request.cts with fetch-compatible type definitions (RequestConfig, RequestHeaders, RawRequestHeaders) that maintain API compatibility with server-side axios usage
  • Removed axios.cts re-export file
  • Moved uuid from runtime to dev dependencies (only used in tests)

Driver Utils (packages/loader/driver-utils)

  • Updated insecureUrlResolver.ts to use native fetch instead of axios
  • Removed axios dependency from package.json

Azure Client E2E Tests (packages/service-clients/end-to-end-tests/azure-client)

  • Refactored AzureClientFactory.ts to use native fetch
  • Introduced FetchResponse interface to replace AxiosResponse type
  • Updated response handling with explicit response.ok checks (fetch doesn't auto-throw on non-2xx)
  • Improved type safety in getContainerIdFromPayloadResponse with explicit type guards
  • Removed AxiosResponse type imports from all test files

@github-actions github-actions bot added base: main PRs targeted against main branch area: driver Driver related issues area: loader Loader related issues dependencies Pull requests that update a dependency file labels Oct 1, 2025
@github-actions github-actions bot added the area: build Build related issues label Oct 1, 2025
@github-actions github-actions bot removed the area: build Build related issues label Oct 1, 2025
@tylerbutler tylerbutler requested a review from Copilot October 7, 2025 01:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors client libraries to replace axios with native fetch for HTTP requests, modernizing the HTTP client implementation and reducing dependencies.

  • Removes axios dependency from multiple packages
  • Replaces axios-based HTTP calls with fetch API
  • Updates type definitions to use custom request types instead of axios types

Reviewed Changes

Copilot reviewed 15 out of 17 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/service-clients/end-to-end-tests/azure-client/src/test/viewContainerVersion.spec.ts Removes axios import and type annotations
packages/service-clients/end-to-end-tests/azure-client/src/test/tree.spec.ts Removes axios import, refactors tree imports, and updates API usage
packages/service-clients/end-to-end-tests/azure-client/src/test/signals.spec.ts Removes axios import and type annotations
packages/service-clients/end-to-end-tests/azure-client/src/test/ddsTests.spec.ts Removes axios import and type annotations
packages/service-clients/end-to-end-tests/azure-client/src/test/containerCreate.spec.ts Removes axios import and SharedTree legacy import
packages/service-clients/end-to-end-tests/azure-client/src/test/audience.spec.ts Removes axios import and type annotations
packages/service-clients/end-to-end-tests/azure-client/src/test/AzureClientFactory.ts Replaces axios with fetch implementation and creates custom response types
packages/service-clients/end-to-end-tests/azure-client/package.json Removes axios dependency
packages/loader/driver-utils/src/insecureUrlResolver.ts Replaces axios with fetch for URL resolution
packages/loader/driver-utils/package.json Removes axios dependency
packages/drivers/routerlicious-driver/src/restWrapperBase.ts Updates type imports to use custom request types
packages/drivers/routerlicious-driver/src/restWrapper.ts Replaces axios with fetch and updates type references
packages/drivers/routerlicious-driver/src/request.cts Adds new custom request type definitions
packages/drivers/routerlicious-driver/src/axios.cts Removes axios type re-exports
packages/drivers/routerlicious-driver/package.json Removes axios dependency and reorganizes dependencies
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Fetch doesn't automatically throw on non-2xx responses like axios did,
so added explicit response.ok check before parsing JSON to ensure
proper error handling.
@tylerbutler tylerbutler marked this pull request as ready for review December 16, 2025 00:48
Comment on lines +240 to +243
// Fetch doesn't auto-throw on non-2xx responses like axios did, so check explicitly
if (!response.ok) {
throw new Error(`Error creating container. Status code: ${response.status}`);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this necessary over the previous approach? We were already explicitly throwing for any response code other than 201.

@tylerbutler tylerbutler changed the title refactor: replace axios with fetch in client libs refactor(drivers): replace axios with native fetch API Jan 13, 2026
@tylerbutler tylerbutler merged commit b2e1bc2 into microsoft:main Jan 13, 2026
30 checks passed
anthony-murphy-agent pushed a commit to anthony-murphy-agent/FluidFramework that referenced this pull request Jan 14, 2026
## Summary

Replaces the axios HTTP client library with native `fetch` API across
client-side packages to reduce bundle size and simplify dependencies.

## Changes

### Routerlicious Driver (`packages/drivers/routerlicious-driver`)
- Replaced axios with native `fetch` via `cross-fetch` polyfill
- Created `request.cts` with fetch-compatible type definitions
(`RequestConfig`, `RequestHeaders`, `RawRequestHeaders`) that maintain
API compatibility with server-side axios usage
- Removed `axios.cts` re-export file
- Moved `uuid` from runtime to dev dependencies (only used in tests)

### Driver Utils (`packages/loader/driver-utils`)
- Updated `insecureUrlResolver.ts` to use native `fetch` instead of
axios
- Removed axios dependency from package.json

### Azure Client E2E Tests
(`packages/service-clients/end-to-end-tests/azure-client`)
- Refactored `AzureClientFactory.ts` to use native `fetch`
- Introduced `FetchResponse` interface to replace `AxiosResponse` type
- Updated response handling with explicit `response.ok` checks (fetch
doesn't auto-throw on non-2xx)
- Improved type safety in `getContainerIdFromPayloadResponse` with
explicit type guards
- Removed `AxiosResponse` type imports from all test files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: driver Driver related issues area: loader Loader related issues base: main PRs targeted against main branch dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants