You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: VpcLatticeV2Model and VpcLatticeV2Envelope reject every real VPC Lattice V2 event #8777
VpcLatticeV2Model and VpcLatticeV2Envelope should parse the events VPC Lattice sends to a target group that uses the V2 event structure.
Current Behaviour
VPC Lattice V2 sends every value in headers and queryStringParameters as a list of strings, even single values. That's in the V2 event structure and in the event captured from a live V2 target group.
VpcLatticeV2Model types both fields as dict[str, str], so the model and the envelope fail on every real event. The captured event gives 7 validation errors. The repo fixture vpcLatticeV2Event.json uses plain strings, which is why the existing tests pass.
frompydanticimportBaseModelfromaws_lambda_powertools.utilities.parserimportenvelopes, parsefromtests.functional.utilsimportload_event# Event captured from a live VPC Lattice V2 target groupevent=load_event("vpcLatticeV2EventWithQueryString.json")
classHello(BaseModel):
hello: strprint(parse(event=event, model=Hello, envelope=envelopes.VpcLatticeV2Envelope))
# ValidationError: 7 validation errors for VpcLatticeV2Model# headers.x-amzn-requestid# Input should be a valid string [type=string_type, input_value=['6ccfc913-...'], input_type=list]# (same for headers.content-type, x-forwarded-for, header1, host,# queryStringParameters.QS1 and queryStringParameters.single)
Possible Solution
Type both fields as dict[str, list[str] | str]. A strict list[str], as TypeScript did, would start rejecting events with plain string values (the docs sample payloads, vpcLatticeV2Event.json, hand-written test events), and those parse today (ADR 0006). Accepting both fixes real events and keeps the old ones working. I have a fix with tests ready and can open a PR once this is triaged.
Steps to Reproduce
Run the snippet above from the repo root on develop.
This looks like the same bug as #8773, which has a fix open in #8774 (both fields typed as dict[str, list[str]], the same shape the TypeScript fix used).
Same bug as #8773, which is already in 3.40.0. Thanks for the list[str] | str argument; I thought about it and I am going strict, the service never sends plain strings and the union would leak into everyone's handler code. Closing as duplicate, keep #8776 open, that one is separate and real.
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.
Activity
blacksoxx commentedon Nov 7, 2026
This looks like the same bug as #8773, which has a fix open in #8774 (both fields typed as
dict[str, list[str]], the same shape the TypeScript fix used).leandrodamascena commentedon Nov 10, 2026
Same bug as #8773, which is already in 3.40.0. Thanks for the
list[str] | strargument; I thought about it and I am going strict, the service never sends plain strings and the union would leak into everyone's handler code. Closing as duplicate, keep #8776 open, that one is separate and real.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.