mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 04:04:06 -08:00
fix(awsLambda Node): fix json data being sent to AWS Lambda as string (#4029)
Fix AWS lamba by not sending json as string
This commit is contained in:
parent
d554128457
commit
c28f69b276
|
@ -1,6 +1,3 @@
|
||||||
import { URL } from 'url';
|
|
||||||
import { Request, sign } from 'aws4';
|
|
||||||
import { OptionsWithUri } from 'request';
|
|
||||||
import { parseString as parseXml } from 'xml2js';
|
import { parseString as parseXml } from 'xml2js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -10,7 +7,7 @@ import {
|
||||||
IWebhookFunctions,
|
IWebhookFunctions,
|
||||||
} from 'n8n-core';
|
} from 'n8n-core';
|
||||||
|
|
||||||
import { ICredentialDataDecryptedObject, IHttpRequestOptions, NodeApiError, NodeOperationError } from 'n8n-workflow';
|
import { IHttpRequestOptions, NodeApiError } from 'n8n-workflow';
|
||||||
|
|
||||||
export async function awsApiRequest(
|
export async function awsApiRequest(
|
||||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||||
|
@ -28,14 +25,14 @@ export async function awsApiRequest(
|
||||||
path,
|
path,
|
||||||
},
|
},
|
||||||
method,
|
method,
|
||||||
body: JSON.stringify(body),
|
body: service === 'lambda' ? body : JSON.stringify(body),
|
||||||
url: '',
|
url: '',
|
||||||
headers,
|
headers,
|
||||||
region: credentials?.region as string,
|
region: credentials?.region as string,
|
||||||
} as IHttpRequestOptions;
|
} as IHttpRequestOptions;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return await this.helpers.requestWithAuthentication.call(this,'aws', requestOptions);
|
return await this.helpers.requestWithAuthentication.call(this, 'aws', requestOptions);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new NodeApiError(this.getNode(), error, { parseXml: true });
|
throw new NodeApiError(this.getNode(), error, { parseXml: true });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue