The `middy-autoproxyresponse` middleware was designed to simplify AWS Lambda proxy responses by automatically wrapping plain JavaScript objects returned from a handler into a `statusCode: 200` response with `Content-Type: application/json`. If a `statusCode` is already present in the returned object, it passes through untouched. The package is currently at version 0.1.0, released in 2018. Given the rapid evolution and numerous breaking changes in the core `middy` framework (which is now in its 7.x series, released frequently), this middleware is highly likely incompatible with modern `middy` versions (v2.x and above), especially since `middy` v5+ is ESM-only. It provides a basic utility that is often reimplemented or achieved with other, more actively maintained `middy` middlewares like `@middy/http-response-serializer` for newer versions.
npm install middy-autoproxyresponseVerified import paths — ran on the pinned version, not inferred.
Demonstrates defining a simple Lambda handler that returns a plain object, which `autoProxyResponse` then converts into a standard API Gateway proxy response.
Consider using the actively maintained `@middy/http-response-serializer` (or similar core middy middlewares) for modern Middy versions, or implementing the response transformation manually.
Avoid using this middleware with `middy` v5.0.0 or later. Migrate to `middy`'s native HTTP response handling or use a modern, ESM-compatible alternative.
For new projects or migrations, prefer `@middy/http-response-serializer` or similar from the official `@middy` ecosystem.
This specific middleware is CommonJS. If you are using a recent version of `middy` (v5.x+) which is ESM-only, `middy-autoproxyresponse` is fundamentally incompatible. Downgrade `middy` to a compatible version (v0.x or v1.x) or replace this middleware with an ESM-compatible alternative.
Ensure that the `middy` core package version is compatible with this middleware (likely `middy@^0.x` or `middy@^1.x`). Given this middleware's age, it's safer to use an actively maintained middleware for current `middy` versions.