From 18f1039da65103e8883f8566acea3ed5c2c8aa9c Mon Sep 17 00:00:00 2001 From: michael-bouvy Date: Mon, 2 Oct 2023 23:20:37 +0200 Subject: [PATCH 1/2] fix(aws-lambda): handle base64 body in AWS Lambda preset --- src/runtime/entries/aws-lambda.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/entries/aws-lambda.ts b/src/runtime/entries/aws-lambda.ts index f906d6d85e..823643f637 100644 --- a/src/runtime/entries/aws-lambda.ts +++ b/src/runtime/entries/aws-lambda.ts @@ -52,7 +52,7 @@ export async function handler( headers: normalizeLambdaIncomingHeaders(event.headers), method, query, - body: event.body, // TODO: handle event.isBase64Encoded + body: event.isBase64Encoded ? Buffer.from(event.body, 'base64').toString('utf8') : event.body, }); // ApiGateway v2 https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.v2 From 674448ebd373dae546af7ace3f0bab1c1e1027c8 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Tue, 3 Oct 2023 07:23:39 +0000 Subject: [PATCH 2/2] chore: apply automated fixes --- src/runtime/entries/aws-lambda.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/runtime/entries/aws-lambda.ts b/src/runtime/entries/aws-lambda.ts index 823643f637..6c291d5a06 100644 --- a/src/runtime/entries/aws-lambda.ts +++ b/src/runtime/entries/aws-lambda.ts @@ -52,7 +52,9 @@ export async function handler( headers: normalizeLambdaIncomingHeaders(event.headers), method, query, - body: event.isBase64Encoded ? Buffer.from(event.body, 'base64').toString('utf8') : event.body, + body: event.isBase64Encoded + ? Buffer.from(event.body, "base64").toString("utf8") + : event.body, }); // ApiGateway v2 https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.v2