transloadit/uppy · error · Error
Missing S3 object key for completing multipart upload
Error message
Missing S3 object key for completing multipart upload
What it means
After a successful OAuth token exchange, Companion needs req.companion.buildURL (a URL builder derived from server options) to redirect the user back to the Uppy client with the uppyAuthToken. If buildURL is missing, Companion cannot construct the redirect and returns 500.
Source
Thrown at packages/@uppy/aws-s3/src/S3Uploader.ts:344
// after part finished uploading, update chunk state
this.#chunkState[i].uploaded = chunk.size
this.#chunkState[i].etag = etag
this.#onProgress()
if (this.#options.onPartComplete) {
this.#options.onPartComplete({
PartNumber: partNumber,
ETag: etag,
})
}
}
const parts = this.#chunkState.flatMap((state, i) =>
state.etag ? [{ partNumber: i + 1, etag: state.etag }] : [],
)
if (this.#key == null) {
throw new Error('Missing S3 object key for completing multipart upload')
}
const { location, key } =
await this.#options.s3Client.completeMultipartUpload({
key: this.#key,
uploadId: this.#uploadId!,
parts,
signal,
})
this.#onSuccess({
location,
key,
uploadId: this.#uploadId,
})
}
#onProgress(): void {View on GitHub (pinned to 5d4dedd02a)
Solutions
- Set the server host/companionUrl option so Companion can build absolute URLs
- Review the Companion standalone/server options for missing required URL fields
- If behind a proxy, configure server.oauthDomain and path prefixes correctly
- Check Companion startup logs for warnings about URL configuration
Example fix
// before
companion({ server: {} })
// after
companion({ server: { host: 'https://companion.myapp.com', path: '/companion' } }) Defensive patterns
Strategy: validation
Validate before calling
if (!process.env.COMPANION_DOMAIN) throw new Error('COMPANION_DOMAIN required for OAuth redirects') Prevention
- Validate required server URL options at Companion boot
- Add a healthcheck that exercises the full OAuth redirect path in staging
- Treat missing buildURL as a deployment misconfiguration, not a runtime error to catch
When it happens
Trigger: The companion middleware did not initialize buildURL — typically because server.host/companionUrl or server.path options are missing or malformed, so the URL builder was never attached to req.companion.
Common situations: Self-hosting Companion with an incomplete server configuration (no companionUrl/host), misconfigured filePath vs domain, or running behind a proxy without the right server options after an upgrade that changed required options.
Related errors
- [s3mini] fileType must be a string
- File data is missing for file ${options.file.id}
- Missing S3 object key for aborting upload
- Missing S3 object key for resuming upload
- Missing S3 object key for uploading part
AI-assisted analysis of transloadit/uppy@5d4dedd02a (2026-08-28).
Data as JSON: /api/errors/d5c7e46280b1af6d.
Report an issue: GitHub.