Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
@middy/warmup
Advanced tools
Warmup middleware for the middy framework, the stylish Node.js middleware engine for AWS Lambda
You can read the documentation at: https://middy.js.org/docs/middlewares/warmup
Warmup middleware that helps to reduce the cold-start issue. Compatible by default with serverless-plugin-warmup
, but it can be configured to suit your implementation.
This middleware allows you to specify a schedule to keep Lambdas that always need to be very responsive warmed-up. It does this by regularly invoking the Lambda, but will terminate early to avoid the actual handler logic from being run.
If you use serverless-plugin-warmup
the scheduling part is done by the plugin and you just have to attach the middleware to your "middyfied" handler. If you don't want to use the plugin you have to create the schedule yourself and define the isWarmingUp
function to define whether the current event is a warmup event or an actual business logic execution.
Important: AWS recently announced Lambda Provisioned Concurrency. If you have this enabled, you do not need this middleware.
To update your code to use Provisioned Concurrency see:
To install this middleware you can use NPM:
npm install --save @middy/warmup
isWarmingUp
: (function) a function that accepts the event
object as a parameter
and returns true
if the current event is a warmup event and false
if it's a regular execution. The default function will check if the event
object has a source
property set to serverless-plugin-warmup
.import middy from '@middy/core'
import warmup from '@middy/warmup'
const isWarmingUp = (event) => event.isWarmingUp === true
const originalHandler = (event, context, cb) => {
/* ... */
}
const handler = middy(originalHandler)
.use(warmup({ isWarmingUp }))
For more documentation and examples, refers to the main Middy monorepo on GitHub or Middy official website.
Everyone is very welcome to contribute to this repository. Feel free to raise issues or to submit Pull Requests.
Licensed under MIT License. Copyright (c) 2017-2022 Luciano Mammino, will Farrell, and the Middy team.
FAQs
Warmup (cold start mitigation) middleware for the middy framework
The npm package @middy/warmup receives a total of 4,446 weekly downloads. As such, @middy/warmup popularity was classified as popular.
We found that @middy/warmup demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.