Repository navigation
Description
Expected Behaviour
VpcLatticeV2Model and VpcLatticeV2Envelope parse the events VPC Lattice sends to a Lambda target group that uses the V2 event structure.
Current Behaviour
With the V2 structure, VPC Lattice sends every header and query string value as a list, even when there's only one value. The VPC Lattice docs show "headers": {"header-key": ["header-value", ...]} and "queryStringParameters": {"key": ["value", ...]}, and the multi-value sections on that page say the same.
VpcLatticeV2Model types both fields as dict[str, str], so every real V2 event fails with a ValidationError, and VpcLatticeV2Envelope can't parse any of them.
The repo already has a real V2 event in tests/events/vpcLatticeV2EventWithQueryString.json. It came from a live target group in aws-powertools/powertools-lambda-typescript#5764 and was added in #8572, and it fails to parse. The parser tests pass because they use vpcLatticeV2Event.json, which has plain string values. #8572 listed this as a follow-up, and the TypeScript parser fixed the same schema in aws-powertools/powertools-lambda-typescript#5773.
Code snippet
from aws_lambda_powertools.utilities.parser.models import VpcLatticeV2Model
# Shortened from tests/events/vpcLatticeV2EventWithQueryString.json
event = {
"version": "2.0",
"path": "/echo?QS1=value1&QS1=value2&single=one",
"method": "POST",
"headers": {
"content-type": ["application/json"],
"header1": ["value1", "value2"],
},
"queryStringParameters": {"QS1": ["value1", "value2"], "single": ["one"]},
"body": '{"hello":"world"}',
"requestContext": {
"serviceNetworkArn": "arn:aws:vpc-lattice:eu-west-1:123456789012:servicenetwork/sn-0123456789abcdef0",
"serviceArn": "arn:aws:vpc-lattice:eu-west-1:123456789012:service/svc-0123456789abcdef0",
"targetGroupArn": "arn:aws:vpc-lattice:eu-west-1:123456789012:targetgroup/tg-0123456789abcdef0",
"identity": {"sourceVpcArn": "arn:aws:ec2:eu-west-1:123456789012:vpc/vpc-0123456789abcdef0"},
"region": "eu-west-1",
"timeEpoch": "1790935900260914",
},
}
VpcLatticeV2Model(**event)pydantic_core._pydantic_core.ValidationError: 4 validation errors for VpcLatticeV2Model
headers.content-type
Input should be a valid string [type=string_type, input_value=['application/json'], input_type=list]
headers.header1
Input should be a valid string [type=string_type, input_value=['value1', 'value2'], input_type=list]
queryStringParameters.QS1
Input should be a valid string [type=string_type, input_value=['value1', 'value2'], input_type=list]
queryStringParameters.single
Input should be a valid string [type=string_type, input_value=['one'], input_type=list]
Possible Solution
Type headers and queryStringParameters as dict[str, list[str]], like multiValueHeaders in the API Gateway model.
Steps to Reproduce
Run the snippet above. Parsing tests/events/vpcLatticeV2EventWithQueryString.json with VpcLatticeV2Model, or with parse(..., envelope=envelopes.VpcLatticeV2Envelope), fails the same way.
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.12
Packaging format used
PyPi
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsComing soon
Activity
leandrodamascena commentedon Nov 10, 2026
Confirmed. Moving to 3.40.0 and taking it myself, together with #8776, see my note in #8774. Keeping the strict
dict[str, list[str]]shape: that is what the service sends.powertools-for-aws-oss-automation commentedon Nov 10, 2026
Warning
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
github-actions commentedon Nov 10, 2026
This is now released under 3.40.0 version!