From 0be531f09378cdf6bfe3eaacd1eb1eed85df73c7 Mon Sep 17 00:00:00 2001 From: Omkar Patil Date: Tue, 19 Nov 2024 07:43:50 -0500 Subject: [PATCH] Add alb event null check for testing convenience --- src/adapter/aws-lambda/handler.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/adapter/aws-lambda/handler.ts b/src/adapter/aws-lambda/handler.ts index 634545e4..fc9199f5 100644 --- a/src/adapter/aws-lambda/handler.ts +++ b/src/adapter/aws-lambda/handler.ts @@ -407,7 +407,7 @@ class ALBProcessor extends EventProcessor { protected getQueryString(event: ALBProxyEvent): string { // In the case of ALB Integration either queryStringParameters or multiValueQueryStringParameters can be present not both - /* + /* In other cases like when using the serverless framework, the event object does contain both queryStringParameters and multiValueQueryStringParameters: Below is an example event object for this URL: /payment/b8c55e69?select=amount&select=currency { @@ -471,7 +471,10 @@ export const getProcessor = (event: LambdaEvent): EventProcessor => } const isProxyEventALB = (event: LambdaEvent): event is ALBProxyEvent => { - return Object.hasOwn(event.requestContext, 'elb') + if (event.requestContext) { + return Object.hasOwn(event.requestContext, 'elb') + } + return false } const isProxyEventV2 = (event: LambdaEvent): event is APIGatewayProxyEventV2 => {