Skip to content

Commit

Permalink
fix(awsLambda Node): fix json data being sent to AWS Lambda as string (
Browse files Browse the repository at this point in the history
…#4029)

Fix AWS lamba by not sending json as string
  • Loading branch information
Joffcom authored Sep 6, 2022
1 parent d554128 commit c28f69b
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/nodes-base/nodes/Aws/GenericFunctions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { URL } from 'url';
import { Request, sign } from 'aws4';
import { OptionsWithUri } from 'request';
import { parseString as parseXml } from 'xml2js';

import {
Expand All @@ -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,
Expand All @@ -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 });
}
Expand Down

0 comments on commit c28f69b

Please sign in to comment.