📄️ 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.
📄️ appconfig
Fetches AppConfig stored configuration and parses out JSON.
📄️ cloudwatch-metrics
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.
📄️ do-not-wait-for-empty-event-loop
This middleware sets context.callbackWaitsForEmptyEventLoop property to false.
📄️ dynamodb
Fetches DynamoDB stored configuration and parses out JSON.
📄️ error-logger
Logs the error and propagates it to the next middleware.
📄️ event-normalizer
Middleware for iterating through an AWS event records, parsing and normalizing nested events.
📄️ http-content-encoding
This middleware take the preferredEncoding output from @middy/http-content-negotiation and applies the encoding to response.body when a string.
📄️ http-content-negotiation
This middleware parses Accept-* headers and provides utilities for HTTP content negotiation (charset, encoding, language and media type).
📄️ http-cors
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.
📄️ http-error-handler
Automatically handles uncaught errors that contain the properties statusCode (number) and message (string) and creates a proper HTTP response
📄️ http-event-normalizer
If you need to access the query string or path parameters in an API Gateway event you
📄️ http-header-normalizer
This middleware normalizes HTTP header names. By default, it normalizes to lowercase. It
📄️ http-json-body-parser
This middleware automatically parses HTTP requests with a JSON body and converts the body into an
📄️ http-multipart-body-parser
Automatically parses HTTP requests with content type multipart/form-data and converts the body into an
📄️ http-partial-response
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.
📄️ http-response-serializer
The Http Serializer middleware lets you define serialization mechanisms based on the current content negotiation.
📄️ http-security-headers
Applies best practice security headers to responses. It's a simplified port of HelmetJS. See HelmetJS documentation for more details.
📄️ http-urlencode-body-parser
This middleware automatically parses HTTP requests with URL-encoded body (typically the result
📄️ http-urlencode-path-parser
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.
📄️ input-output-logger
Logs the incoming request (input) and the response (output).
📄️ rds-signer
Fetches RDS credentials to be used when connecting to RDS with IAM roles.
📄️ s3-object-response
This middleware is a Proof of Concept and requires real world testing before use, not recommended for production
📄️ s3
Fetches S3 stored configuration and parses out JSON.
📄️ secrets-manager
This middleware fetches secrets from AWS Secrets Manager.
📄️ service-discovery
Fetches Service Discovery instances to be used when connecting to other AWS services.
📄️ sqs-partial-batch-failure
Middleware for handling partially failed SQS batches.
📄️ ssm
This middleware fetches parameters from AWS Systems Manager Parameter Store.
📄️ sts
Fetches STS credentials to be used when connecting to other AWS services.
📄️ validator
This middleware automatically validates incoming events and outgoing responses against custom
📄️ 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.
📄️ ws-json-body-parser
This middleware automatically parses WebSocket requests with a JSON body and converts the body into an
📄️ ws-response
Post message to WebSocket connection.