Skip to content

Tech debt: Centralize DictWrapper functions for query, header, json_data, etc. #2424

Closed
@heitorlessa

Description

@heitorlessa

Why is this needed?

API Gateway (REST, HTTP), ALB, Lambda Function URL, and VPC Lattice unfortunately have differences in the payload. This leads to having nearly the same functionality in Event Source Data Classes to work around these differences and limitations.

These will eventually lead to a drift in implementation, making it harder to debug.

Latest example: https://github.com/awslabs/aws-lambda-powertools-python/pull/2358/files#diff-209f210ae09d053ce73d291e9f7b3869015b7f592f186be386518f152aa497adR56

Which area does this relate to?

Event Source Data Classes

Suggestion

Within aws_lambda_powertools/utilities/data_classes/common.py, we could have standalone functions like get_header_value, and create new ones to handle JSON and Base64 deserialization.

This means updating code in several places where we might have HTTP Headers, HTTP Query Strings, HTTP JSON payload, Base64 payload -- SNS, SQS, Kinesis, API Gateway, AppSync, etc.

Acknowledgment

Metadata

Metadata

Assignees

No one assigned

    Labels

    event_sourcesEvent Source Data Class utilitytech-debtTechnical Debt tasks

    Type

    No type

    Projects

    Status

    Shipped

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions