From c28f69b276fe46c42dfb62753b565ebae37431f5 Mon Sep 17 00:00:00 2001 From: Jonathan Bennetts Date: Tue, 6 Sep 2022 09:01:48 +0100 Subject: [PATCH] fix(awsLambda Node): fix json data being sent to AWS Lambda as string (#4029) Fix AWS lamba by not sending json as string --- packages/nodes-base/nodes/Aws/GenericFunctions.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/nodes-base/nodes/Aws/GenericFunctions.ts b/packages/nodes-base/nodes/Aws/GenericFunctions.ts index 0ab4a76d9dfe4..cb90134e1b130 100644 --- a/packages/nodes-base/nodes/Aws/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Aws/GenericFunctions.ts @@ -1,6 +1,3 @@ -import { URL } from 'url'; -import { Request, sign } from 'aws4'; -import { OptionsWithUri } from 'request'; import { parseString as parseXml } from 'xml2js'; import { @@ -10,7 +7,7 @@ import { IWebhookFunctions, } from 'n8n-core'; -import { ICredentialDataDecryptedObject, IHttpRequestOptions, NodeApiError, NodeOperationError } from 'n8n-workflow'; +import { IHttpRequestOptions, NodeApiError } from 'n8n-workflow'; export async function awsApiRequest( this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, @@ -28,14 +25,14 @@ export async function awsApiRequest( path, }, method, - body: JSON.stringify(body), + body: service === 'lambda' ? body : JSON.stringify(body), url: '', headers, region: credentials?.region as string, } as IHttpRequestOptions; try { - return await this.helpers.requestWithAuthentication.call(this,'aws', requestOptions); + return await this.helpers.requestWithAuthentication.call(this, 'aws', requestOptions); } catch (error) { throw new NodeApiError(this.getNode(), error, { parseXml: true }); }