diff --git a/packages/signature-v4-multi-region/src/SignatureV4MultiRegion.ts b/packages/signature-v4-multi-region/src/SignatureV4MultiRegion.ts index ab51ee0c36d3a..2042168c4eaab 100644 --- a/packages/signature-v4-multi-region/src/SignatureV4MultiRegion.ts +++ b/packages/signature-v4-multi-region/src/SignatureV4MultiRegion.ts @@ -9,8 +9,8 @@ import { RequestSigningArguments, } from "@smithy/types"; -import { OptionalSigV4aSigner, signatureV4aContainer } from "./signature-v4a-container"; import { OptionalCrtSignerV4, signatureV4CrtContainer } from "./signature-v4-crt-container"; +import { OptionalSigV4aSigner, signatureV4aContainer } from "./signature-v4a-container"; /** * @internal @@ -39,8 +39,7 @@ export class SignatureV4MultiRegion implements RequestPresigner, RequestSigner { public async sign(requestToSign: HttpRequest, options: RequestSigningArguments = {}): Promise { if (options.signingRegion === "*") { - const signer = await this.getSigv4aSigner(); - return signer.sign(requestToSign, options); + return this.getSigv4aSigner().sign(requestToSign, options); } return this.sigv4Signer.sign(requestToSign, options); } @@ -54,16 +53,14 @@ export class SignatureV4MultiRegion implements RequestPresigner, RequestSigner { options: RequestSigningArguments = {} ): Promise { if (options.signingRegion === "*") { - const signer = await this.getSigv4aSigner(); - return signer.signWithCredentials(requestToSign, credentials, options); + return this.getSigv4aSigner().signWithCredentials(requestToSign, credentials, options); } return this.sigv4Signer.signWithCredentials(requestToSign, credentials, options); } public async presign(originalRequest: HttpRequest, options: RequestPresigningArguments = {}): Promise { if (options.signingRegion === "*") { - const signer = await this.getSigv4aSigner(); - return signer.presign(originalRequest, options); + return this.getSigv4aSigner().presign(originalRequest, options); } return this.sigv4Signer.presign(originalRequest, options); } @@ -79,7 +76,7 @@ export class SignatureV4MultiRegion implements RequestPresigner, RequestSigner { return this.sigv4Signer.presignWithCredentials(originalRequest, credentials, options); } - private async getSigv4aSigner(): Promise | InstanceType> { + private getSigv4aSigner(): InstanceType | InstanceType { if (!this.sigv4aSigner) { if (signatureV4CrtContainer.CrtSignerV4) { // CRT implementation