Skip to content

fix(parser): accept ALB events with multi-value headers enabled - #8850

Open
Manishram-ai wants to merge 1 commit into
aws-powertools:developfrom
Manishram-ai:fix/parser-alb-multi-value-headers
Open

Manishram-ai wants to merge 1 commit into
aws-powertools:developfrom
Manishram-ai:fix/parser-alb-multi-value-headers

Conversation

@Manishram-ai

Copy link
Copy Markdown
Contributor

Issue number:
closes #8847

Summary

Changes

  • AlbModel now has multiValueHeaders and multiValueQueryStringParameters, and headers and queryStringParameters are no longer required. ALB sends one pair or the other depending on the target group's multi-value headers setting, and the pair it leaves out comes back as an empty dict, the same as in the ALBEvent data class.
  • The field types don't change, so code that reads event.headers keeps working without a None check.
  • Two new tests parse the repo's albMultiValueQueryStringEvent.json and albMultiValueHeadersEvent.json.

User experience

Today every event from a target group with multi-value headers turned on fails with Field required for headers and queryStringParameters, so AlbModel can't be used with that setting at all. With this change those events parse, and the snippet in the issue prints {'parameter1': ['value1', 'value2'], 'parameter2': ['value']}. Events from target groups without multi-value headers parse the same as before, with the two new fields set to {}.

Verification

  • Both new tests fail on develop with Field required for headers and queryStringParameters, and pass with this change.
  • tests/unit/parser and tests/functional/parser: 274 passed on Python 3.10, 3.12 and 3.14.
  • ruff check, ruff format --check and mypy are clean, and tests/performance passes.
  • I didn't run this against a live ALB. The event shapes come from the ALB docs linked in the issue and the two multi-value events already in tests/events.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@Manishram-ai
Manishram-ai requested a review from a team as a code owner November 16, 2026 19:12
@boring-cyborg boring-cyborg Bot added the tests label Nov 16, 2026
@powertools-for-aws-oss-automation powertools-for-aws-oss-automation Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 16, 2026
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: AlbModel rejects events when the target group has multi-value headers enabled

1 participant