s3: add debugging code

This commit is contained in:
Girish Ramakrishnan
2025-07-14 21:59:46 +02:00
parent 8b5fe714e1
commit e53ec3e43c

View File

@@ -69,7 +69,8 @@ function createS3Client(apiConfig, options) {
forcePathStyle: apiConfig.s3ForcePathStyle === true ? true : false, // Use vhost style instead of path style - https://forums.aws.amazon.com/ann.jspa?annID=6776
region: apiConfig.region || 'us-east-1',
credentials,
requestHandler: requestHandler
requestHandler,
// logger: console
};
if (options.retryStrategy) clientConfig.retryStrategy = options.retryStrategy;
@@ -85,7 +86,22 @@ function createS3Client(apiConfig, options) {
requestHandler.agent = new http.Agent({});
}
return constants.TEST ? new globalThis.S3Mock(clientConfig) : new S3(clientConfig);
const client = constants.TEST ? new globalThis.S3Mock(clientConfig) : new S3(clientConfig);
// https://github.com/aws/aws-sdk-js-v3/issues/6761#issuecomment-2574480834
// client.middlewareStack.add((next, context) => async (args) => {
// debug('AWS SDK context', context.clientName, context.commandName);
// debug('AWS SDK request input', JSON.stringify(args.input));
// const result = await next(args);
// console.log('AWS SDK request output:', result.output);
// return result;
// },
// {
// name: 'MyMiddleware',
// step: 'build',
// override: true,
// });
return client;
}
async function getAvailableSize(apiConfig) {