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) {