Skip to content

Consider replacing @supabase/supabase-js with direct fetch calls #331

Done

Description

@riglar

What

@supabase/supabase-js is one of our largest runtime dependencies, but we use only two small parts of it:

  1. src/gateways/supabase-gateway.ts: one Storage call to create a signed upload URL (the upload itself already goes through tus-js-client).
  2. src/gateways/cli-auth-gateway.ts: refreshing a session (auth.refreshSession), plus the error helpers isAuthApiError and isAuthSessionMissingError.

Both are plain HTTP endpoints that we could call with fetch.

Why

  • A much smaller dependency tree and a smaller standalone binary.
  • Fewer transitive packages to receive security advisories for.

Risks

  • Session refresh is subtle. The current code depends on how supabase-js maps auth errors. For example, it turns session_not_found into a "session missing" error. A replacement must keep this behaviour exactly, or users could be logged out by mistake, or a dead session could keep retrying. The refresh paths would need tests first.
  • We would take on tracking any API changes ourselves.

Suggestion

Only do this if binary size or dependency count becomes a real concern. If we do it, start with the Storage call (simple) and leave auth refresh for last, behind tests.

🤖 Generated with Claude Code

Activity

  1. finalerock44 commented on Nov 24, 2026

    @finalerock44
    Contributor

    Done on dev: #313 moved session refresh to the dcd API, and #358 removed the unused signed-URL upload path, which was the last user of @supabase/supabase-js, and dropped the dependency. It ships with the next CLI release.

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