Skip to content

Commit ac12f65

Browse files
committed
SDK | fix replication issue
Signed-off-by: Naveen Paul <[email protected]>
1 parent 2edf186 commit ac12f65

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/agent/block_store_services/block_store_s3.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
'use strict';
33

44
const _ = require('lodash');
5-
const { S3 } = require('@aws-sdk/client-s3');
65

76
const config = require('../../../config');
87
const P = require('../../util/promise');
@@ -13,6 +12,7 @@ const size_utils = require('../../util/size_utils');
1312
const BlockStoreBase = require('./block_store_base').BlockStoreBase;
1413
const { RpcError } = require('../../rpc');
1514
const { NodeHttpHandler } = require("@smithy/node-http-handler");
15+
const noobaa_s3_client = require('../../sdk/noobaa_s3_client/noobaa_s3_client');
1616

1717

1818
const DEFAULT_REGION = 'us-east-1';
@@ -40,7 +40,7 @@ class BlockStoreS3 extends BlockStoreBase {
4040
RoleSessionName: 'block_store_operations'
4141
};
4242
} else {
43-
this.s3cloud = new S3({
43+
this.s3cloud = noobaa_s3_client.get_s3_client_v3_params({
4444
endpoint: endpoint,
4545
credentials: {
4646
accessKeyId: this.cloud_info.access_keys.access_key.unwrap(),
@@ -58,13 +58,14 @@ class BlockStoreS3 extends BlockStoreBase {
5858
config.EXPERIMENTAL_DISABLE_S3_COMPATIBLE_DELEGATION.DEFAULT;
5959
this.disable_metadata = config.EXPERIMENTAL_DISABLE_S3_COMPATIBLE_METADATA[this.cloud_info.endpoint_type] ||
6060
config.EXPERIMENTAL_DISABLE_S3_COMPATIBLE_METADATA.DEFAULT;
61-
this.s3cloud = new S3({
61+
this.s3cloud = noobaa_s3_client.get_s3_client_v3_params({
6262
endpoint: endpoint,
6363
forcePathStyle: true,
6464
credentials: {
6565
accessKeyId: this.cloud_info.access_keys.access_key.unwrap(),
6666
secretAccessKey: this.cloud_info.access_keys.secret_key.unwrap(),
6767
},
68+
region: DEFAULT_REGION,
6869
applyChecksum: cloud_utils.disable_s3_compatible_bodysigning(endpoint),
6970
requestHandler: new NodeHttpHandler({
7071
httpsAgent: http_utils.get_unsecured_agent(endpoint)

src/util/cloud_utils.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const RpcError = require('../rpc/rpc_error');
66
const http_utils = require('./http_utils');
77
const string_utils = require('./string_utils');
88
const AWS = require('aws-sdk');
9-
const { S3 } = require('@aws-sdk/client-s3');
109
const url = require('url');
1110
const _ = require('lodash');
1211
const SensitiveString = require('./sensitive_string');
@@ -33,7 +32,7 @@ function find_cloud_connection(account, conn_name) {
3332

3433
async function createSTSS3SDKv3Client(params, additionalParams) {
3534
const creds = await generate_aws_sdkv3_sts_creds(params, additionalParams.RoleSessionName);
36-
return new S3({
35+
return noobaa_s3_client.get_s3_client_v3_params({
3736
credentials: creds,
3837
region: params.region || config.DEFAULT_REGION,
3938
endpoint: additionalParams.endpoint,
@@ -78,7 +77,7 @@ function get_signed_url(params, expiry = 604800, custom_operation = 'getObject')
7877
sslEnabled: false,
7978
signatureVersion: get_s3_endpoint_signature_ver(params.endpoint),
8079
s3DisableBodySigning: disable_s3_compatible_bodysigning(params.endpoint),
81-
region: 'eu-central-1',
80+
region: params.region || config.DEFAULT_REGION,
8281
httpOptions: {
8382
// Setting the agent is not mandatory in this case as this s3 client
8483
// is only used to acquire a signed Url

0 commit comments

Comments
 (0)