{"library":"middy-autoproxyresponse","title":"Middy AutoProxyResponse Middleware","description":"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.","language":"javascript","status":"abandoned","last_verified":"Thu Apr 23","install":{"commands":["npm install middy-autoproxyresponse"],"cli":null},"imports":["import { autoProxyResponse } from 'middy-autoproxyresponse'","import middy from '@middy/core'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import middy from '@middy/core';\nimport { autoProxyResponse } from 'middy-autoproxyresponse';\n\ninterface MyEvent {\n  name?: string;\n}\n\ninterface MyContext extends Record<string, any> {}\n\nasync function handler(event: MyEvent, context: MyContext) {\n  // Simulate some async operation\n  await new Promise(resolve => setTimeout(resolve, 100));\n\n  if (event.name) {\n    return { message: `Hello, ${event.name}!` };\n  } else {\n    // This will be converted to a 200 OK JSON response by autoProxyResponse\n    return { greeting: 'Hello, world!' };\n  }\n}\n\nexport const wrappedHandler = middy(handler)\n  .use(autoProxyResponse());\n\n// To simulate execution (e.g., for local testing)\n// wrappedHandler({ name: 'Registry' }, {} as MyContext)\n//   .then(res => console.log('Response:', JSON.stringify(res, null, 2)));\n","lang":"typescript","description":"Demonstrates defining a simple Lambda handler that returns a plain object, which `autoProxyResponse` then converts into a standard API Gateway proxy response.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}