From a43ea177ebcc983ccc440662f397bf8b1698b4df Mon Sep 17 00:00:00 2001 From: Nathan Apter Date: Wed, 21 Dec 2022 23:36:49 -0500 Subject: [PATCH] fix(AWS DynamoDB Node): Fix issue pagination and simplify issue #4956 #4957 (#4959) * Added 'M' type to decode attribute for dynamodb * Fixed bug with return all. Headers from the previous iteration were being passed causing an invalid signature error --- packages/nodes-base/nodes/Aws/DynamoDB/GenericFunctions.ts | 3 ++- packages/nodes-base/nodes/Aws/DynamoDB/utils.ts | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/nodes-base/nodes/Aws/DynamoDB/GenericFunctions.ts b/packages/nodes-base/nodes/Aws/DynamoDB/GenericFunctions.ts index 5197c6968ac83..c701f0338ff18 100644 --- a/packages/nodes-base/nodes/Aws/DynamoDB/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Aws/DynamoDB/GenericFunctions.ts @@ -66,7 +66,8 @@ export async function awsApiRequestAllItems( let responseData; do { - responseData = await awsApiRequest.call(this, service, method, path, body, headers); + const originalHeaders = Object.assign({}, headers); //The awsapirequest function adds the hmac signature to the headers, if we pass the modified headers back in on the next call it will fail with invalid signature + responseData = await awsApiRequest.call(this, service, method, path, body, originalHeaders); if (responseData.LastEvaluatedKey) { body!.ExclusiveStartKey = responseData.LastEvaluatedKey; } diff --git a/packages/nodes-base/nodes/Aws/DynamoDB/utils.ts b/packages/nodes-base/nodes/Aws/DynamoDB/utils.ts index ffc64063a7cfd..4bbb572a13233 100644 --- a/packages/nodes-base/nodes/Aws/DynamoDB/utils.ts +++ b/packages/nodes-base/nodes/Aws/DynamoDB/utils.ts @@ -81,6 +81,8 @@ function decodeAttribute(type: AttributeValueType, attribute: string) { case 'SS': case 'NS': return attribute; + case 'M': + return simplify(attribute); default: return null; }