MODULE_NOT_FOUND error when attempting to invoke my Lambda function locally

Not sure what the issue is yet. . . I’m using hapi and typescript and taking some code which runs locally via npm scripts and trying to port it over to Serverless. I suspect there are one or more silly issues here, but I don’t get much debug output.

When I run invoke locally, I get this:
Error: Exception encountered when loading /home/matthew/repos/pin/office-365-addin-backend
at AwsInvokeLocal.invokeLocalNodeJs (/home/matthew/repos/pin/office-365-addin-backend/node_modules/serverless/lib/plugins/aws/invokeLocal/index.js:272:13)
at AwsInvokeLocal.invokeLocal (/home/matthew/repos/pin/office-365-addin-backend/node_modules/serverless/lib/plugins/aws/invokeLocal/index.js:125:19)
From previous event:
at Object.invoke:local:invoke [as hook] (/home/matthew/repos/pin/office-365-addin-backend/node_modules/serverless/lib/plugins/aws/invokeLocal/index.js:26:10)
at BbPromise.reduce (/home/matthew/repos/pin/office-365-addin-backend/node_modules/serverless/lib/classes/PluginManager.js:390:55)
From previous event:
at PluginManager.invoke (/home/matthew/repos/pin/office-365-addin-backend/node_modules/serverless/lib/classes/PluginManager.js:390:22)
at PluginManager.run (/home/matthew/repos/pin/office-365-addin-backend/node_modules/serverless/lib/classes/PluginManager.js:421:17)
at variables.populateService.then.then (/home/matthew/repos/pin/office-365-addin-backend/node_modules/serverless/lib/Serverless.js:157:33)
at runCallback (timers.js:810:20)
at tryOnImmediate (timers.js:768:5)
at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
at Serverless.run (/home/matthew/repos/pin/office-365-addin-backend/node_modules/serverless/lib/Serverless.js:144:8)
at serverless.init.then (/home/matthew/repos/pin/office-365-addin backend/node_modules/serverless/bin/serverless:43:50)
at

Any helps is appreciated.

1 Like