diff --git a/packages/@aws-cdk/aws-custom-resource-sdk-adapter/lib/api-call.ts b/packages/@aws-cdk/aws-custom-resource-sdk-adapter/lib/api-call.ts index 1e96b5063b7bc..206963362a7dd 100644 --- a/packages/@aws-cdk/aws-custom-resource-sdk-adapter/lib/api-call.ts +++ b/packages/@aws-cdk/aws-custom-resource-sdk-adapter/lib/api-call.ts @@ -188,7 +188,7 @@ export async function coerceSdkv3Response(value: unknown): Promise { return value.toString('utf8'); } if (ArrayBuffer.isView(value)) { - return decoder.decode(value.buffer); + return decoder.decode(value); } if (Array.isArray(value)) { diff --git a/packages/@aws-cdk/aws-custom-resource-sdk-adapter/test/api-call.test.ts b/packages/@aws-cdk/aws-custom-resource-sdk-adapter/test/api-call.test.ts index 8d5d11d1d21b0..ea3b62b9fe696 100644 --- a/packages/@aws-cdk/aws-custom-resource-sdk-adapter/test/api-call.test.ts +++ b/packages/@aws-cdk/aws-custom-resource-sdk-adapter/test/api-call.test.ts @@ -103,6 +103,7 @@ test.each([ { transformToString: () => 'foo' }, Buffer.from('foo'), new TextEncoder().encode('foo'), + new Uint8Array(new TextEncoder().encode('this is foo string').buffer, 8, 3), ])('coerce %p', async (fooValue) => { expect(await coerceSdkv3Response({ foo: fooValue,