From 39742cc2f2906d6549a86ac270f5f2b0227b9f3e Mon Sep 17 00:00:00 2001 From: Alex Petty Date: Mon, 27 Apr 2020 14:28:25 -0500 Subject: [PATCH 1/2] Check for the existence of a handler property before trying to have serverless-offline set up an event handler. --- src/ServerlessOffline.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ServerlessOffline.js b/src/ServerlessOffline.js index 5bf166841..330fbb405 100644 --- a/src/ServerlessOffline.js +++ b/src/ServerlessOffline.js @@ -293,11 +293,13 @@ export default class ServerlessOffline { const { http, httpApi, schedule, websocket } = event if (http || httpApi) { - httpEvents.push({ - functionKey, - handler: functionDefinition.handler, - http: http || httpApi, - }) + if (!!functionDefinition.handler) { + httpEvents.push({ + functionKey, + handler: functionDefinition.handler, + http: http || httpApi, + }) + } } if (schedule) { From fdd043da2312835405bb814cac6d344deb2d3b80 Mon Sep 17 00:00:00 2001 From: Alex Petty Date: Mon, 27 Apr 2020 14:44:43 -0500 Subject: [PATCH 2/2] Match preferred linting style for serverless offline by removing double negation --- src/ServerlessOffline.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ServerlessOffline.js b/src/ServerlessOffline.js index 330fbb405..6cced24fb 100644 --- a/src/ServerlessOffline.js +++ b/src/ServerlessOffline.js @@ -293,7 +293,7 @@ export default class ServerlessOffline { const { http, httpApi, schedule, websocket } = event if (http || httpApi) { - if (!!functionDefinition.handler) { + if (functionDefinition.handler) { httpEvents.push({ functionKey, handler: functionDefinition.handler,