Skip to content

[tech-debt 4/5 higher risk] sdk: handle async errors in storage, node selection, relay and chats - #14777

Merged
dylanjeffers merged 1 commit into
mainfrom
fix/tech-debt-4-sdk
Nov 12, 2026
Merged

dylanjeffers merged 1 commit into
mainfrom
fix/tech-debt-4-sdk

Conversation

@dylanjeffers

Copy link
Copy Markdown
Contributor

Fourth of five PRs that re-ship #14665 on current main, ordered from lowest to highest risk. Branched off main, independent of the others.

What's in it

sdk error-handling fixes, with a patch changeset, so merging this publishes an sdk version.

  • Storage uploads: tus doesn't await onSuccess, so a polling failure became an unhandled rejection and start() never settled. Polling results now go to resolve/reject.
  • Aborted uploads: the abort check sat inside the polling try, so the abort error was caught and retried every 3s for up to an hour. It's checked before the try.
  • StorageNodeSelector: if the first node list fetch failed, selection ordered the bootstrap nodes and kept that order after a later fetch succeeded. The ordering is now dropped when the list refreshes, and selection holds a local reference so a refresh mid-selection can't swap the list out from under it. New test covers it.
  • Request signature middleware: after logout or a signing failure it kept attaching the previous user's cached signature. The cache is cleared on error. New test covers it.
  • SolanaRelayWalletAdapter.connect(): connecting stayed true forever if getFeePayer threw.
  • SolanaRelay.relay(): a non-JSON or null error body replaced the real ResponseError with a parse error.
  • SolanaClient.buildTransaction(): the 1.5x priority multiplier can produce a fractional fee, and setComputeUnitPrice throws on it when converting to BigInt. The fee is rounded. New test covers it.
  • ChatsApi: a rejected public key lookup was cached, which broke create/invite for that user until reload. Websocket handler rejections were unhandled; they're now logged.

Why this tier

Published package, and uploads now reject in cases where they used to hang. Callers that never handled a rejection from upload.start() will now see one.

Dropped from #14665

  • The constructor-time updateAvailableStorageNodes unhandled rejection: main now fetches the node list lazily with its own catch.
  • isNodeHealthy getting the sdk logger: skipped here to keep this PR independent of tier 1, which moves the function.

Verified

  • tsc and eslint (changed files): clean.
  • sdk vitest: all files pass, including the new tests.

Not verified

No end-to-end upload against a real node.

🤖 Generated with Claude Code

…hats

From #14665:
- Storage: forward tus onSuccess polling failures to reject; stop polling after abort
- StorageNodeSelector: drop the bootstrap ordering when the node list refreshes
- Request signature middleware: clear the cached signature on errors
- SolanaRelayWalletAdapter: reset connecting when getFeePayer throws
- SolanaRelay: don't mask ResponseError with a body parse error
- SolanaClient: round the priority fee so BigInt() doesn't throw
- ChatsApi: don't cache rejected public key lookups; catch websocket handler errors

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Nov 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6fe83a6

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

This PR includes changesets to release 4 packages
Name Type
@audius/sdk Patch
@audius/sdk-legacy Patch
@audius/protocol-dashboard Patch
@audius/sp-actions 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

@dylanjeffers
dylanjeffers merged commit 6e30f1f into main Nov 12, 2026
33 checks passed
@dylanjeffers
dylanjeffers deleted the fix/tech-debt-4-sdk branch November 12, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant