transloadit/uppy · info · Error

Companion request failed

Error message

Companion request failed: ${response.statusText}

What it means

The logout controller cleans the session and returns 400 when no provider instance is available — meaning Companion cannot perform a server-side token revocation for that provider, though it still clears the local session first (cleanSession()).

Solutions

  1. Align the providers configured on Companion with what the client uses
  2. Ensure the request carries a valid provider session token
  3. If the goal is only local cleanup, treat 400 as acceptable — the session was still cleaned server-side

Example fix

// before
const res = await fetch('/companion/box/logout', { method: 'POST' })
if (!res.ok) throw new Error('logout failed')
// after
const res = await fetch('/companion/box/logout', { method: 'POST' })
// 400 still means the local session was cleaned; provider revocation was skipped
Defensive patterns

Strategy: fallback

Validate before calling

const res = await fetch(`${companionUrl}/${provider}/logout`, { method: 'POST' })
// 400 still means local session was cleaned; treat as success for local logout

Try / catch

try {
  await logout()
} catch {
  // best-effort: clear local state regardless of server response
  clearLocalSession()
}

Prevention

When it happens

Trigger: Calling /logout for a provider that is not configured on this Companion instance, or when the provider session middleware failed to instantiate the provider (bad/expired token).

Common situations: Frontend and backend provider lists out of sync; logging out after the provider config was removed; token already expired so provider was not attached.

Related errors


AI-assisted analysis of transloadit/uppy@5d4dedd02a (2026-08-28). Data as JSON: /api/errors/0726173f8f231432. Report an issue: GitHub.

Appendix: source

Thrown at packages/@uppy/aws-s3/src/s3-client/CompanionS3.ts:23

/**
 * S3Companion is an S3Client that interacts with a Companion server to perform S3 operations.
 */
class S3Companion extends S3Client {
  readonly companionEndpoint: string

  constructor({
    companionEndpoint,
    requestAbortTimeout,
  }: { companionEndpoint: string; requestAbortTimeout?: number | undefined }) {
    super({ requestAbortTimeout })
    this.companionEndpoint = companionEndpoint
  }

  private async _fetch(path: string, opts?: RequestInit) {
    const response = await fetch(`${this.companionEndpoint}/s3${path}`, opts)
    if (!response.ok) {
      throw new Error(`Companion request failed: ${response.statusText}`)
    }
    return response
  }

  private async _request({
    url,
    method,
    data,
    onProgress,
    signal,
    contentType,
  }: {
    url: string
    method: IT.HttpMethod
    data?: XMLHttpRequestBodyInit
    onProgress?: IT.OnProgressFn
    signal?: AbortSignal
    contentType?: string

View on GitHub (pinned to 5d4dedd02a)