From a2297ee916dd79463d4efcfd6f7fe1f8e0e50d87 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Thu, 13 May 2021 17:43:12 +0200 Subject: [PATCH] fix(AWS Local Invocation): Report invalid handler path meaningfully --- lib/plugins/aws/invokeLocal/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/plugins/aws/invokeLocal/index.js b/lib/plugins/aws/invokeLocal/index.js index 43e2fb92160..0faafe05efc 100644 --- a/lib/plugins/aws/invokeLocal/index.js +++ b/lib/plugins/aws/invokeLocal/index.js @@ -749,6 +749,13 @@ class AwsInvokeLocal { throw new Error(`Exception encountered when loading ${pathToHandler}`); } + if (typeof lambda !== 'function') { + throw new ServerlessError( + `Lambda handler "${handlerPath}" does not point function property`, + 'INVALID_LAMBDA_HANDLER_PATH' + ); + } + function handleError(err) { let errorResult; if (err instanceof Error) {