invoke local "The webpack plugin could not find the configuration file"
See original GitHub issueThis is a (Bug Report)
Description
serverless invoke local -f <functionName>
doesn’t work
For bug reports:
-
What went wrong? A few weird errors occur:
- It says that more than one matching handler is found
- It is looking in the wrong place for the
webpack.config.js
file which is located at./webpack.config.js
-
What did you expect should have happened?
serverless invoke local
should work in a project that functions correctly withserverless-offline
-
What was the config you used?
service: api
package:
individually: true
provider:
name: aws
runtime: provided
stage: "${opt:stage, 'local'}"
region: us-east-1
environment:
DEBUG: '*,-babel,-babel:config:*'
SLS_DEBUG: '*'
functions:
test:
handler: src/jobs/test.handler
layers: # add layer
- arn:aws:lambda:us-east-1:553035198032:layer:nodejs10:13
plugins:
- serverless-webpack
- serverless-offline
custom:
serverless-offline:
host: 0.0.0.0
port: 8080
providedRuntime: nodejs10
webpack:
webpackConfig: 'webpack.config.js'
packager: 'yarn'
includeModules: true
-
What stacktrace or error message from your provider did you see?
The webpack plugin could not find the configuration file at: /Users/user/work/project/api/.webpack/test/webpack.config.js
Similar or dependent issue(s):
Additional Data
- Serverless-Webpack Version you’re using: v5.3.0
- Webpack version you’re using: v4.33.0
- Serverless Framework Version you’re using: v1.44.1
- Operating System: macOS 10.14.5 (18F132)
- Stack Trace (if available):
$ serverless invoke local -f test
Serverless: Invoke webpack:validate
Serverless: Invoke webpack:compile
Serverless: Bundling with Webpack...
Time: 269ms
Built at: 06/05/2019 1:57:53 PM
Asset Size Chunks Chunk Names
src/jobs/test.js 4.07 KiB src/jobs/test [emitted] src/jobs/test
src/jobs/test.js.map 3.86 KiB src/jobs/test [emitted] src/jobs/test
Entrypoint src/jobs/test = src/jobs/test.js src/jobs/test.js.map
[./src/jobs/test.ts] 89 bytes {src/jobs/test} [built]
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Invoke webpack:validate
Serverless: WARNING: More than one matching handlers found for 'src/jobs/test'. Using 'src/jobs/test.js'.
Serverless Error ---------------------------------------
The webpack plugin could not find the configuration file at: /Users/user/work/project/api/.webpack/test/webpack.config.js
Stack Trace --------------------------------------------
ServerlessError: The webpack plugin could not find the configuration file at: /Users/user/work/project/api/.webpack/test/webpack.config.js
at ServerlessWebpack.validate (/Users/user/work/project/api/node_modules/serverless-webpack/lib/validate.js:111:33)
at ServerlessWebpack.tryCatcher (/Users/user/work/project/api/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/user/work/project/api/node_modules/bluebird/js/release/promise.js:517:31)
at Promise._settlePromise (/Users/user/work/project/api/node_modules/bluebird/js/release/promise.js:574:18)
at Promise._settlePromiseCtx (/Users/user/work/project/api/node_modules/bluebird/js/release/promise.js:611:10)
at _drainQueueStep (/Users/user/work/project/api/node_modules/bluebird/js/release/async.js:142:12)
at _drainQueue (/Users/user/work/project/api/node_modules/bluebird/js/release/async.js:131:9)
at Async._drainQueues (/Users/user/work/project/api/node_modules/bluebird/js/release/async.js:147:5)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/user/work/project/api/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
at process.topLevelDomainCallback (domain.js:120:23)
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
OS: darwin
Node Version: 10.15.3
Serverless Version: 1.44.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:23 (14 by maintainers)
Top Results From Across the Web
sls offline cloudside command gives error webpack plugin ...
The webpack plugin could not find the configuration file at: ... offline: Function names exposed for local invocation by aws-sdk: ...
Read more >The webpack plugin could not find the configuration file
So it would seem like some path concatenation is happening when trying to get at the webpack.config.js, but I can't figure out where...
Read more >Resolving Serverless Webpack Issues | by Dustin Goodman
I ended up finding the Webpack Stats Plugin and was able to get the needed stats.json produced with some minor configuration changes.
Read more >Serverless Webpack in Lambda Simplified 101 - Learn
Lambda functions can be built using a Serverless Webpack plugin. ... They should never access files that are not in their current working ......
Read more >Configuration
Out of the box, webpack won't require you to use a configuration file. However, it will assume the entry point of your project...
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
bump?
Can anyone help with this? I’m still unable to make it work.