Skip to content

Commit c459a18

Browse files
committed
- Add error object handling for v3
- Explain why an S3 client is used Signed-off-by: Ben <[email protected]>
1 parent b8ce165 commit c459a18

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/sdk/namespace_gcp.js

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ const {
2121
UploadPartCopyCommand,
2222
} = require('@aws-sdk/client-s3');
2323

24+
const { fix_error_object } = require('./noobaa_s3_client/noobaa_s3_client');
25+
2426
/**
2527
* @implements {nb.Namespace}
2628
*/
@@ -62,6 +64,11 @@ class NamespaceGCP {
6264
private_key: this.private_key,
6365
}
6466
});
67+
/* An S3 client is needed for multipart upload since GCP only supports multipart i[;pads] via the S3-compatible XML API
68+
* https://cloud.google.com/storage/docs/multipart-uploads
69+
* This is also the reason an HMAC key is generated as part of `add_external_connection` - since the standard GCP credentials
70+
* cannot be used in conjunction with the S3 client.
71+
*/
6572
this.s3_client = new S3Client({
6673
endpoint: 'https://storage.googleapis.com',
6774
region: 'auto', //https://cloud.google.com/storage/docs/aws-simple-migration#storage-list-buckets-s3-python
@@ -375,6 +382,7 @@ class NamespaceGCP {
375382
const command = new UploadPartCommand(request);
376383
res = await this.s3_client.send(command);
377384
} catch (err) {
385+
fix_error_object(err);
378386
object_sdk.rpc_client.pool.update_issues_report({
379387
namespace_resource_id: this.namespace_resource_id,
380388
error_code: String(err.code),

0 commit comments

Comments
 (0)