📄️ Official middlewares
Middy comes with a series of additional (opt-in) plugins that are officially maintained by the core team and kept in sync with every release of the core package.
📄️ Third-party middlewares
The following middlewares are created and maintained outside this project. We cannot guarantee for its functionality.
Fetches AppConfig stored configuration and parses out JSON.
This middleware hydrates lambda's context.metrics property with an instance of MetricLogger. This instance can be used to easily generate custom metrics from Lambda functions without requiring custom batching code, making blocking network requests or relying on 3rd party software.
This middleware sets context.callbackWaitsForEmptyEventLoop property to false.
Fetches DynamoDB stored configuration and parses out JSON.
Logs the error and propagates it to the next middleware.
Middleware for iterating through an AWS event records, parsing and normalizing nested events.
This middleware take the preferredEncoding output from @middy/http-content-negotiation and applies the encoding to response.body when a string.
This middleware parses Accept-* headers and provides utilities for HTTP content negotiation (charset, encoding, language and media type).
This middleware sets HTTP CORS headers (Access-Control-Allow-Origin, Access-Control-Allow-Headers, Access-Control-Allow-Credentials), necessary for making cross-origin requests, to the response object.
Automatically handles uncaught errors that contain the properties statusCode (number) and message (string) and creates a proper HTTP response
If you need to access the query string or path parameters in an API Gateway event you
This middleware normalizes HTTP header names. By default, it normalizes to lowercase. It
This middleware automatically parses HTTP requests with a JSON body and converts the body into an
Automatically parses HTTP requests with content type multipart/form-data and converts the body into an
Filtering the data returned in an object or JSON stringified response has never been so easy. Add the httpPartialResponse middleware to your middleware chain, specify a custom filteringKeyName if you want to and that's it. Any consumer of your API will be able to filter your JSON response by adding a querystring key with the fields to filter such as fields=firstname,lastname.
The Http Serializer middleware lets you define serialization mechanisms based on the current content negotiation.
Applies best practice security headers to responses. It's a simplified port of HelmetJS. See HelmetJS documentation for more details.
This middleware automatically parses HTTP requests with URL-encoded body (typically the result
This middleware automatically parses HTTP requests with URL-encoded paths. This can happen when using path variables (ie //) for an endpoint and the UI encodeURIComponent the values before making the request.
Logs the incoming request (input) and the response (output).
Fetches RDS credentials to be used when connecting to RDS with IAM roles.
This middleware is a Proof of Concept and requires real world testing before use, not recommended for production
Fetches S3 stored configuration and parses out JSON.
This middleware fetches secrets from AWS Secrets Manager.
Fetches Service Discovery instances to be used when connecting to other AWS services.
Middleware for handling partially failed SQS batches.
This middleware fetches parameters from AWS Systems Manager Parameter Store.
Fetches STS credentials to be used when connecting to other AWS services.
This middleware automatically validates incoming events and outgoing responses against custom
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 automatically parses WebSocket requests with a JSON body and converts the body into an
Post message to WebSocket connection.