Skip to content

3.0.0

Compare
Choose a tag to compare
@willfarrell willfarrell released this 13 May 01:00
e09a3a5

Checkout UPGRADE.md to see what are the main breaking changes and how to migrate to this new version if coming from 2.x.

Version 3.x of Middy no longer supports Node.js versions 12.x. You are highly encouraged to move to Node.js 16.x.
With the Node.js version change all packages are now ECMAScript Modules along side CommonJS Modules.

Notable changes

  • New WebSocket middlewares
  • HTTP & WebSocket Routers!
  • Better error handling
  • Timeout error handling
  • Errors now use { cause } for better context

Additions

  • New middleware (http-content-encoding, http-router, service-discovery, ws-json-body-parser, ws-response, ws-router)
  • core
    • Added .handler() method to allow easier understanding of the execution cycle
    • lambdaHandler can now be passed an AbortController signal
    • internal events can now be monitored using Proxy
  • util
    • getInternal error now includes cause set to an array of Errors
    • Catch when X-Ray is applied outside of handler invocation scope

Breaking Changes

  • core
    • The order onError being called is now reversed to match after
      • If you only use @middy/* middlewares no change should be required
      • If you have custom error handling middleware or other custom middleware that return response, additional testing is high recommended
    • Deprecate applyMiddleware() and __middlewares
  • util
    • normalizeHttpResponse now takes request and mutates response
    • getCache will return {} instead of undefined when not found
  • Deprecated setToEnv option from all middleware
  • Will now throw error if not an http event in http-event-normalizer
  • Change default charset from binary/latin1 to utf-8 within http-multipart-body-parser
  • Renamed default option to defaultContentType to improve maintainability in http-response-serializer
  • Deprecate expectCt in http-security-headers
  • sqs-partial-batch-failure completely rewritten
  • Renamed default option to defaultContentType http-response-serializer
  • normalizeHttpResponse now takes request and mutates response
  • Change where errors are stored, from request.error.details to request.error.cause in validator

Removed

  • s3-key-normalizer in favour of event-normalizer
  • sqs-json-body-parser in favour of event-normalizer

Maintenance

  • Better error reporting when dealing with Promise arrays

Full Changelog: 2.5.7...3.0.0