Version 1.x of Middy features decoupled independent packages published on npm under the @middy
namespace. The core middleware engine has been moved to @middy/core
and all the other middlewares are moved into their own packages as well. This allows to only install the features that are needed and to keep your Lambda dependencies small. See the list below to check which packages you need based on the middlewares you use:
- Core middleware functionality ->
@middy/core
cache
->@middy/cache
cors
->@middy/http-cors
doNotWaitForEmptyEventLoop
->@middy/do-not-wait-for-empty-event-loop
httpContentNegotiation
->@middy/http-content-negotiation
httpErrorHandler
->@middy/http-error-handler
httpEventNormalizer
->@middy/http-event-normalizer
httpHeaderNormalizer
->@middy/http-header-normalizer
httpMultipartBodyParser
->@middy/http-json-body-parser
httpPartialResponse
->@middy/http-partial-response
jsonBodyParser
->@middy/http-json-body-parser
s3KeyNormalizer
->@middy/s3-key-normalizer
secretsManager
->@middy/secrets-manager
ssm
->@middy/ssm
validator
->@middy/validator
urlEncodeBodyParser
->@middy/http-urlencode-body-parser
warmup
->@middy/warmup
In Middy 0.x the httpHeaderNormalizer
middleware normalizes HTTP header names into their own canonical format, for instance Sec-WebSocket-Key
(notice the casing). In Middy 1.x this behavior has been changed to provide header names in lowercase format (e.g. sec-webSocket-key
). This new behavior is more consistent with what Node.js core http
package does and what other famous http frameworks like Express or Fastify do, so this is considered a more intuitive approach.
When updating to Middy 1.x, make sure you double check all your references to HTTP headers and switch to the lowercase version to read them.
All the middy core modules have been already updated to support the new format, so you should worry only about your userland code.
Version 1.x of Middy no longer supports Node.js versions 6.x and 8.x as these versions have been dropped by the AWS Lambda runtime itself and not supported anymore by the Node.js community. You are highly encouraged to move to Node.js 12 or 10, which are the new supported versions in Middy 1.x.