Instructions on getting warmup to work with serverless-webpack
See original GitHub issueI preface this with the fact that I’m a webpack newbie so this may be suboptimal.
If using the serverless-webpack
plugin then you need to make some changes to webpack.config.js
to get serverless-plugin-warmup
to work.
- Add a new chunk for warmup with the specific path that the warmup plugin uses.
- Add an
output
section as per above. This ensures that the warmup handler is appears in the bundle at the same path as it would have originally.
For example:
entry: {
handler: [/* possibly other entry points like babel-polyfill, ... */ './handler.js'],
'_warmup/index': './_warmup/index.js',
},
output: {
libraryTarget: 'commonjs', // <- as per serverless-webpack README
path: '.webpack',
filename: '[name].js',
},
An issue with this setup is that serverless webpack invoke
no longer works because _warmup
does not exist then.
Another potential issue is the reliance on the _warmup/index.js
path not changing.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Instructions on getting warmup to work with serverless-webpack
Add a new chunk for warmup with the specific path that the warmup plugin uses. Add an output section as per above. This...
Read more >Serverless Plugin Warmup
WarmUp solves cold starts by creating a scheduled lambda (the warmer) that invokes all the selected service's lambdas in a configured time interval...
Read more >Optimizing your Lambda cold starts with serverless-webpack
A comprehensive guide to using the serverless-webpack plugin for optimizing your Lambda cold start times, with common gotchas and ...
Read more >Resolving Serverless Webpack Issues | by Dustin Goodman
A story about how I debugged an issue with our webpack bundles on a serverless infrastructure and the key takeaways about developing ...
Read more >Serverless Webpack in Lambda Simplified 101 - Learn | Hevo
This blog explains the different aspects of Serverless Webpack in Lambda. In addition to that, it describes AWS Lambda as well.
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 FreeTop 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
Top GitHub Comments
@damonmaria I simply copy the whole _warmup dir with copy-webpack-plugin like so:
plugins: [new CopyWebpackPlugin({ from: '_warmup', to: '_warmup' })],
For anyone else that finds this thread, the following webpack.config.js works for me now:
serverless:
1.24.1
serverless-plugin-warmup:3.3.0-rc.1
serverless-webpack:4.0.0
webpack:4.0.0