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: VPCLatticeV2Resolver with enable_validation fails on every request body (AttributeError: 'list' object has no attribute 'strip') #8776
With enable_validation=True, a VPCLatticeV2Resolver route that takes a body parameter (Body(), Form() or a Pydantic model) should parse and validate the request body, the same as the other resolvers do.
Current Behaviour
VPC Lattice V2 sends every header value as a list, for example "content-type": ["application/json"]. OpenAPIRequestValidationMiddleware reads Content-Type as a string in two places:
handler passes the same value to _is_form_content_type, which also calls .strip()
On a real V2 event both get a list, so every request to a route with a body parameter fails with AttributeError: 'list' object has no attribute 'strip' before it reaches the handler.
Header, query and cookie parameters, CORS and compression already handle list values. Only these two Content-Type reads don't.
Code snippet
fromtypingimportAnnotatedfrompydanticimportBaseModelfromaws_lambda_powertools.event_handlerimportVPCLatticeV2Resolverfromaws_lambda_powertools.event_handler.openapi.paramsimportBodyfromtests.functional.utilsimportload_event# Event captured from a live VPC Lattice V2 target groupevent=load_event("vpcLatticeV2EventWithQueryString.json")
print("content-type as VPC Lattice V2 sends it:", event["headers"]["content-type"])
classItem(BaseModel):
hello: strapp=VPCLatticeV2Resolver(enable_validation=True)
@app.post("/echo")defecho(item: Annotated[Item, Body()]):
returnitem.model_dump()
print(app.resolve(event, {}))
# AttributeError: 'list' object has no attribute 'strip'# openapi_validation.py:144 content_type = app.current_event.headers.get("content-type", "").strip()
Possible Solution
Read Content-Type through a small helper that joins a list value into a string, and use it in both places. The other resolvers always pass a string there, so nothing changes for them. I have a fix with tests ready and can open a PR once this is triaged.
Steps to Reproduce
Check out develop and run the snippet above from the repo root.
Confirmed, separate from the parser bug. Content-Type is read as a string in two places of the validation middleware and nothing else in the resolver has that gap. I know you have a fix ready and I appreciate that you waited for triage. Since it needs to land with #8773 in 3.40.0 this week, I am going to do both in one go. You get the reporter credit in the release notes.
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
leandrodamascena commentedon Nov 10, 2026
Confirmed, separate from the parser bug. Content-Type is read as a string in two places of the validation middleware and nothing else in the resolver has that gap. I know you have a fix ready and I appreciate that you waited for triage. Since it needs to land with #8773 in 3.40.0 this week, I am going to do both in one go. You get the reporter credit in the release notes.
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!