Skip to content

Error helpers in errors.ts (isAPIError, isErrorRetryable, APIErrorCodes) are not exported from the package entry point #1848

Description

@andres-dejesus

src/errors.ts exports APIErrorCodes (with per-code retryable flags), isAPIError, isErrorRetryable, and isConnectionIDError, but src/index.ts never re-exports the module, so none of them are importable from stream-chat (verified on 9.51.0 and current master).

Meanwhile ErrorFromResponse from the same module is publicly reachable, and dist/types/errors.d.ts ships in the package — so TS tooling happily autocompletes the helpers, and the failure only surfaces at build time:

Error: Export isAPIError doesn't exist in target module
The export isAPIError was not found in module [project]/node_modules/stream-chat/dist/esm/index.mjs [app-client] (ecmascript).
All exports of the module are statically known (It doesn't have dynamic exports).

(Turbopack / Next.js 16, statically analyzed ESM. Runtimes with looser CJS interop resolve the import to undefined instead, which is arguably worse since it fails silently.)

Use case: implementing an app-level send-retry policy that fails fast on non-retryable API errors (validation, message-too-long, permissions) while retrying retryable ones (rate limit, timeout). The SDK already encodes exactly this knowledge in APIErrorCodes, but integrators currently have to copy the table into app code to use it.

Would you accept adding export * from './errors' (or a curated subset) to src/index.ts?

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