transloadit/uppy · warning · Error

No uploadId returned

Error message

No uploadId returned

What it means

The preauth endpoint expects a JSON body containing a `params` property. If the body is not an object or lacks `params`, Companion logs 'invalid request data received' and returns 400 without issuing a pre-auth token.

Source

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

  }: 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')

    return { uploadId, key }
  }

  public override async uploadPart({
    key,
    uploadId,
    data,
    partNumber,
    onProgress,
    signal,
  }: IT.UploadPartParams) {
    const response = await this._fetch(
      `/multipart/${encodeURIComponent(uploadId)}/${encodeURIComponent(partNumber)}?${new URLSearchParams({ key })}`,
      {
        method: 'GET',
        signal,

View on GitHub (pinned to 5d4dedd02a)

Solutions

  1. Send a JSON body with the data nested under `params`
  2. Set the Content-Type: application/json header
  3. Validate the payload shape before sending

Example fix

// before
await fetch('/companion/url/preauth', { method: 'POST', body: JSON.stringify({ apiKey: 'x' }) })
// after
await fetch('/companion/url/preauth', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ params: { apiKey: 'x' } }),
})
Defensive patterns

Strategy: validation

Validate before calling

const payload = { params: { apiKey: 'x' } }
if (!('params' in payload)) throw new Error('params required')
await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) })

Type guard

const isPreauthBody = (b: unknown): b is { params: Record<string, unknown> } =>
  typeof b === 'object' && b !== null && 'params' in b

Prevention

When it happens

Trigger: POSTing to /:providerName/preauth with an empty body, form-encoded body, or a JSON body missing the params key (e.g. sending credentials directly instead of nested under params).

Common situations: Client sends { apiKey: 'x' } instead of { params: { apiKey: 'x' } }; missing Content-Type: application/json so req.body is not parsed; older client versions using a different payload shape.

Related errors


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