Skip to content

fix(core): show safe feedback when provider connection fails without structured error - #6721

Open
Thrizzio wants to merge 1 commit into
transloadit:mainfrom
Thrizzio:fix/provider-connection-safe-feedback
Open

Thrizzio wants to merge 1 commit into
transloadit:mainfrom
Thrizzio:fix/provider-connection-safe-feedback

Conversation

@Thrizzio

Copy link
Copy Markdown

Summary

Fixes Issue #6635 by ensuring that unhandled provider connection and authentication failures (such as rejected getGrant() promises, network fetch rejections, and plain-text HTTP 400/503 responses) surface safe, sanitized feedback to the user instead of failing silently.

Closes #6635

Problem

When a provider connection failed without returning a structured Companion error payload (e.g. UserFacingApiError), handleError logged the error to the console but left uppy.getState().info completely empty. The UI provided zero feedback to the user. Furthermore, initial connection failures could leave the plugin in an authenticated: true or invalid state, locking the user out of the connection view and preventing retries.

Changes

  1. Sanitized Error Feedback (handleError.ts):
    • Added a fallback in handleError for unhandled connection errors that emits a translated warning via uppy.info(uppy.i18n('companionError'), 'warning', 5000).
    • Filtered out local file selection/restriction errors (such as AggregateError and .isRestriction) so local file drops are never accidentally relabeled as Companion connection failures.
    • Preserved silent handling of isAuthError and isAbortError, as well as structured UserFacingApiError messages.
  2. OAuth Cancellation vs. Failure (Provider.ts):
    • Refactored loginOAuth to strictly distinguish user cancellations (popup window closure or abort signals) from real backend/socket failures. User cancellations throw an AbortError (triggering authAborted), while socket/network dropouts bubble up as connection errors.
  3. Retry Recovery (ProviderView.tsx):
    • Reset authenticated state to false when initial root folder listing or handleAuth fails, returning the UI back to AuthView with an active Connect button so the user can successfully retry once the grant or backend recovers.
  4. Testing (handleError.test.ts, Provider.test.ts, TransloaditStorage.browser.test.tsx):
    • Added comprehensive unit and browser-level regression tests covering getGrant() rejections with sentinel strings, network fetch errors, plain-text 503 responses, and successful retry flows.

Verification

  • Unit & Browser Tests: All tests across @uppy/core, @uppy/transloadit-storage, and @uppy/s3 pass successfully.
  • Typecheck & Lint: corepack yarn typecheck and workspace checks pass with 0 errors.

@changeset-bot

changeset-bot Bot commented Oct 14, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3528d94

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show safe feedback when provider connection fails without a structured Companion error

1 participant