Skip to content

TypeScript SDK: drop axios in favor of the generated fetch client? #5534

Open

Description

@Codeshark-NET

The TypeScript SDK ships axios as a runtime dependency (seen on 1.46.0, still present on 1.47.2). It has led to dependency audit findings in our project that we then have to work around, and dropping it would be cleaner.

I read through sdks/typescript and it doesn't look critically dependent on axios:

  • src/clients/rest/generated-fetch/ is already generated from the same OpenAPI spec, and core/client.ts builds on it via createFetchApi.
  • rest-api.ts defines a RestApi type that both generated clients satisfy, so the feature clients are written once.
  • The fetch client serializes array query params as repeated keys, matching the qs arrayFormat: 'repeat' setting the axios client uses.
  • The remaining axios usage is the generated src/clients/rest/generated/ client, rest/api.ts (auth header, qs serializer, https.Agent for NODE_TLS_REJECT_UNAUTHORIZED=0), the axiosConfig parameter threaded through HatchetClient, LegacyHatchetClient and embedded.ts, and isAxiosError checks in streams.ts and rest/errors.ts.

The one public surface I see is axiosConfig?: AxiosRequestConfig on HatchetClient.init. Users passing proxies, agents or timeouts through it would break.

I'm happy to take a stab at this. Before I start, which would you prefer?

  1. A deprecation path first: keep axiosConfig working for a release or two while adding a fetch-style option (for example a custom fetch or dispatcher), then remove axios in the next major.
  2. A PR with the full rewrite right away, treating the change as breaking.

If there are behaviors you know the axios client relies on that the fetch client doesn't cover, let me know 🤘

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions