transloadit/uppy · critical · TypeError

[s3mini] fileType must be a string

Error message

[s3mini] fileType must be a string

What it means

The oauth-redirect endpoint needs req.companion.buildURL (from server URL configuration) to construct the redirect back to the provider callback. If buildURL is missing it cannot build any URL and returns 500 — a server configuration problem, not a client error.

Source

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

      onProgress,
      signal,
    })

    return {
      location: `${url}${fields.key}`, // `url` is returned by the signer as the bucket URL without any path, but trailing slash, so we need to add the key (path) to get the full object URL
      etag: U.sanitizeETag(xhr.getResponseHeader('etag')),
      key: fields.key,
    }
  }

  public override async createMultipartUpload({
    key: keyIn,
    fileType = C.DEFAULT_STREAM_CONTENT_TYPE,
    metadata,
    signal,
  }: IT.CreateMultipartUploadParams) {
    if (typeof fileType !== 'string') {
      throw new TypeError(`${C.ERROR_PREFIX}fileType must be a string`)
    }

    const method = 'POST'
    const response = await this._fetch('/multipart', {
      method,
      body: JSON.stringify({ filename: keyIn, metadata, type: fileType }),
      headers: { 'content-type': 'application/json' },
      signal,
    })
    const {
      key,
      uploadId,
    }: { key?: string; uploadId?: string; bucket?: string } =
      await response.json()

    if (uploadId == null) throw new Error('No uploadId returned')
    if (key == null) throw new Error('No key returned')

View on GitHub (pinned to 5d4dedd02a)

Solutions

  1. Configure server.host (or companionUrl) and server.path in Companion options
  2. Set the corresponding environment variables (COMPANION_DOMAIN / COMPANION_PATH) in your deployment
  3. Verify startup logs for URL configuration warnings and test the endpoint again

Example fix

// before
companion({ server: { protocol: 'https' } })
// after
companion({ server: { host: 'companion.example.com', protocol: 'https', path: '/companion' } })
Defensive patterns

Strategy: validation

Validate before calling

if (!companionServerConfig.host) throw new Error('server.host is required for OAuth')

Prevention

When it happens

Trigger: Companion is started without the required server host/companionUrl options (or path), so the middleware never attached buildURL; then any request to the oauth-redirect endpoint fails.

Common situations: Self-hosting with incomplete server options, especially behind reverse proxies; upgrading Companion where required URL options changed; environment variables for host/URL missing in the deployment.

Related errors


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