sls invoke local with webpack v3.0.0 throws "module not found"
See original GitHub issueThis is a (Bug Report / Feature Proposal)
Bug report
Description
Installed v3.0.0 to try out invoke local
. The previous version works fine on the same repo using sls webpack...
I can see that SLS builds with webpack but then throws the error about missing module (see stack trace).
Additional Data
- Serverless-Webpack Version you’re using: 3.0.0
- Webpack version you’re using: 3.5.0
- Serverless Framework Version you’re using: 1.19.0
- Operating System: Windows 10
- Stack Trace (if available):
{ Error: Cannot find module './.webpack/service/handler'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at AwsInvokeLocal.invokeLocalNodeJs (./npm/node_modules/serverless/lib/plugins/aws/invokeLocal/index.js:156:33)
at AwsInvokeLocal.invokeLocal (./npm/node_modules/serverless/lib/plugins/aws/invokeLocal/index.js:114:19)
at AwsInvokeLocal.tryCatcher (./npm/node_modules/serverless/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (./npm/node_modules/serverless/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (./npm/node_modules/serverless/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (./npm/node_modules/serverless/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (./npm/node_modules/serverless/node_modules/bluebird/js/release/promise.js:693:18)
at Async._drainQueue (./npm/node_modules/serverless/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (./npm/node_modules/serverless/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (./npm/node_modules/serverless/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:637:20)
at tryOnImmediate (timers.js:610:5)
at processImmediate [as _immediateCallback] (timers.js:582:5) code: 'MODULE_NOT_FOUND' }
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Serverless Webpack - Serverless Framework: Plugins
A Serverless Framework plugin to build your lambda functions with Webpack. ... Support of serverless invoke local and serverless invoke local --watch ...
Read more >Serverless Framework with AWS Lambda error "Cannot find ...
I'm trying to use the Serverless Framework to create a Lambda function that uses open weather NPM module. However ...
Read more >Serverless Webpack in Lambda Simplified 101 - Learn | Hevo
When you specify a module in both the forceInclude and forceExclude arrays, the exclude array wins, and the module is not packaged. Local...
Read more >serverless-offline/community - Gitter
Hey folks. Just wondering if sls-offline supports sls v3 as it is now, or not. I'm getting hit with Detected unrecognized CLI options:...
Read more >Troubleshoot deployment issues in Lambda
General: Cannot find, cannot load, unable to import, class not found, no such file or directory ... Error: Handler 'handler' missing on module...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks! Changing the
entry
works fine!Can you try to use automatic entry resolution, so that the plugin tries to determine the handler? Please change the webpack.conf.js as follows:
Additionally you should use Webpack 2.x.x or Webpack 3.x.x (as a dev dependency of your project). You have to use
module.rules
instead ofmodules.loaders
for the newer webpack versions (the sample below also uses babel-preset-node6). Webpack 1.x.x might not work very well.