opendal
opendal copied to clipboard
Multipart upload error on GCS
Save gcs cache failed: Error: Unexpected (permanent) at Writer::write, context: { uri: https://storage.googleapis.com/upload/storage/v1/b/xxx/o?uploadType=resumable&name=cloud/cache/Linux/go/xxx/xxx/cache.tzst&upload_id=ACJd0No-AuMDWKM0kCVnjavxxx686_MltwDqow-J_vbVrZ0mfhyxxxokY0Oql7cjS4yWlqs4CD-_HjTPmasgjbHcZ, response: Parts { status: 400, version: HTTP/1.1, headers: {"content-type": "text/plain; charset=utf-8", "content-length": "261", "date": "Mon, 24 Jun 2024 02:55:25 GMT", "server": "UploadServer"} }, service: gcs, path: Linux/go/xxx/xxx/cache.tzst, write_buf: 65536 } => Invalid request. The number of bytes uploaded is required to be equal or greater than 262144, except for the final request (it's recommended to be the exact multiple of 262144). The received request contained 65536 bytes, which does not meet this requirement.
code:
const op = new Operator(provider, { endpoint, bucket, root });
const rs = fs.createReadStream(archivePath);
const w = await op.writer(object);
const ws = w.createWriteStream();
await pipeline(rs, ws);
await finished(rs);