{"record":{"id":"d5c7e46280b1af6d","repo":"transloadit/uppy","slug":"missing-s3-object-key-for-completing-multipart-upl","errorCode":null,"errorMessage":"Missing S3 object key for completing multipart upload","messagePattern":"Missing S3 object key for completing multipart upload","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@uppy/aws-s3/src/S3Uploader.ts","lineNumber":344,"sourceCode":"      // after part finished uploading, update chunk state\n      this.#chunkState[i].uploaded = chunk.size\n      this.#chunkState[i].etag = etag\n      this.#onProgress()\n\n      if (this.#options.onPartComplete) {\n        this.#options.onPartComplete({\n          PartNumber: partNumber,\n          ETag: etag,\n        })\n      }\n    }\n\n    const parts = this.#chunkState.flatMap((state, i) =>\n      state.etag ? [{ partNumber: i + 1, etag: state.etag }] : [],\n    )\n\n    if (this.#key == null) {\n      throw new Error('Missing S3 object key for completing multipart upload')\n    }\n\n    const { location, key } =\n      await this.#options.s3Client.completeMultipartUpload({\n        key: this.#key,\n        uploadId: this.#uploadId!,\n        parts,\n        signal,\n      })\n\n    this.#onSuccess({\n      location,\n      key,\n      uploadId: this.#uploadId,\n    })\n  }\n\n  #onProgress(): void {","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/transloadit/uppy/blob/5d4dedd02a1ac0ae022c75c54aca76558f88e256/packages/@uppy/aws-s3/src/S3Uploader.ts#L326-L362","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\ncompanion({ server: {} })\n// after\ncompanion({ server: { host: 'https://companion.myapp.com', path: '/companion' } })","handlingStrategy":"validation","validationCode":"if (!process.env.COMPANION_DOMAIN) throw new Error('COMPANION_DOMAIN required for OAuth redirects')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["companion","oauth","configuration","http-500"],"backgroundTag":"missing-server-config","analyzedSha":"5d4dedd02a1ac0ae022c75c54aca76558f88e256","analyzedAt":"2026-08-28T12:18:41.267Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}