{"library":"middy-invocation","title":"Middy Invocation Middleware","description":"A middleware for the Middy framework (v2.5.3+ peer dependency) that provides global access to current AWS Lambda invocation event and context from anywhere in your code, eliminating the need to pass them as arguments through function calls. This is a small, focused utility with no active development since v1.0.0 (2022). Key differentiator: it uses async hooks (presumably) to store the invocation context, enabling access from deeply nested modules. Similar libraries include @middy/core's built-in context sharing, but this offers a simpler getter pattern. Only one known release (v1.0.0) with no changelog or updates.","language":"javascript","status":"active","last_verified":"Sat Apr 25","install":{"commands":["npm install middy-invocation"],"cli":null},"imports":["const invocation = require('middy-invocation');","const { event } = require('middy-invocation'); const evt = event();","const { context } = require('middy-invocation'); const ctx = context();"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const middy = require('@middy/core');\nconst invocation = require('middy-invocation');\n\nconst baseHandler = async (event, context) => {\n  // Access event and context from anywhere\n  const { event: getEvent, context: getContext } = require('middy-invocation');\n  const evt = getEvent();\n  const ctx = getContext();\n  console.log('Request ID:', ctx.awsRequestId);\n  return { statusCode: 200, body: JSON.stringify(evt) };\n};\n\nmodule.exports.handler = middy(baseHandler).use(invocation());","lang":"javascript","description":"Shows middleware registration and how to access event/context via getter functions in a handler.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}