Skip to content

Lambda Wrappers #27

@joshua-dean

Description

@joshua-dean

It's a common need while debugging to log the event (and sometimes context) of a Lambda function, but this isn't always desirable in a production system. When called via API Gateway, the Lambda handlers always have these two parameters, so creating functions that wrap these would be straightforward. If the Lambda build process is fully automatic (as it would be using the CDK for the backend), adding a flag that applies a wrapper to all Lambda handlers would also be straightforward.

The simplest version of this would simply wrap something that logs the event and context (optionally to their own CloudWatch log group) for dev builds. More complex variants could do comparison of event information to validate certain features, such as using sourceIp to validate a Web ACL.

Normal log streams wouldn't be muddied by a bunch of (usually) irrelevant data, but there would still be a single toggle to revert to "dev mode".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions