V3: Invoke lokally does not have access to files bundled with the file-loader
See original GitHub issueBug Report
Description
I have a sample-file.yaml
file I want to bundle this together with my lambda function using file-loader.
Executing locally with sls webpack invoke -f test
does not have this bundled file in it’s environment. It is bundled to upload for aws though.
Additional Data
Minimal failing example on github
- Serverless-Webpack Version 2.2.0 and 3.0.0 branches
- Webpack version: 3.4.1
- Serverless Framework Version: 1.19.0
- Operating System: linux
Stack Trace
$ sls webpack invoke -f test
{ handler: './handler.js' }
Serverless: Bundling with Webpack...
Time: 2892ms
Asset Size Chunks Chunk Names
59ca0efa9f5633cb0371bbc0355478d8.yaml 13 bytes [emitted]
handler.js 3.21 kB 0 [emitted] main
[0] ./handler.js 183 bytes {0} [built]
[1] external "fs" 42 bytes {0} [not cacheable]
[2] ./sample-file.yaml 83 bytes {0} [built]
Serverless: Run function test...
Error --------------------------------------------------
ENOENT: no such file or directory, open '59ca0efa9f5633cb0371bbc0355478d8.yaml'
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Forums: forum.serverless.com
Chat: gitter.im/serverless/serverless
Your Environment Information -----------------------------
OS: linux
Node Version: 6.11.1
Serverless Version: 1.19.0
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
file-loader - webpack - JS.ORG
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >Webpack file-loader outputs [object Module] - Stack Overflow
I get no errors. Here is my webpack configuration and index.html . const projectRoot = path.resolve(__dirname, ...
Read more >Resolve "ClassNotFoundExeption" errors from Java Lambda ...
The ClassNotFoundException error occurs when a Java runtime loads a class by its fully qualified name, but doesn't locate the class.
Read more >Esbuild - Serverless Framework: Plugins
serverless-esbuild. Serverless plugin for zero-config JavaScript and TypeScript code bundling using promising fast & furious esbuild bundler and minifier.
Read more >Writing a custom webpack loader - Redd Developer
mp3 files. Using a custom loader. There are two ways to use a loader: tell webpack to resolve it from a local file,...
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
I believe this is happening again.
serverless-webpack
5.1.1
I temporarily fixed it like this:
Where
pathToFile
either comes from arequire
statement or is a hardcoded path provided by you.