Bug: Set-Cookie values passed as a header are comma-joined into one invalid header on HTTP API and Function URL responses
Maintainers usually reply within 1 day
@saquibjawedbit is already working on this.
Since Nov 28, 2026.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
Research direction
Start with HttpApiHeadersSerializer.serialize, which currently comma-joins list-valued headers, and reproduce the behavior using the provided APIGatewayHttpResolver snippet with apiGatewayProxyV2Event_GET.json. Add or update serializer tests to cover case-insensitive Set-Cookie headers and verify values are moved into the response cookies field while other headers remain unchanged. Also check the equivalent LambdaFunctionUrlResolver path and run the relevant functional test suite.
Written by the indexing model from the issue text.
Description
Expected Behaviour
When a route returns Response(headers={"Set-Cookie": [...]}) with APIGatewayHttpResolver or LambdaFunctionUrlResolver, each value should reach the client as its own Set-Cookie header, the same as passing them through cookies=. Payload format 2.0 has no multi-value headers, so the values belong in the response cookies field.
Current Behaviour
HttpApiHeadersSerializer joins every list header with ", ", including Set-Cookie. The client gets one header such as session=abc; Expires=Wed, 21 Oct 2026 07:28:00 GMT, theme=dark, which browsers read as a single cookie, so the second cookie is lost and the first gets a broken Expires. Set-Cookie cannot be comma-joined (RFC 6265 section 3); the REST/ALB multi-value serializer already sends them separately.
Code snippet
from aws_lambda_powertools.event_handler import APIGatewayHttpResolver, Response
from aws_lambda_powertools.shared.cookies import Cookie
from tests.functional.utils import load_event
app = APIGatewayHttpResolver()
@app.get("/my/path")
def handler():
return Response(
200,
"text/plain",
"ok",
headers={"Set-Cookie": ["session=abc; Expires=Wed, 21 Oct 2026 07:28:00 GMT", "theme=dark"]},
cookies=[Cookie("lang", "en")],
)
result = app.resolve(load_event("apiGatewayProxyV2Event_GET.json"), None)
print(result["headers"])
print(result["cookies"])
Possible Solution
In HttpApiHeadersSerializer.serialize, treat a Set-Cookie header (any casing) as cookies: append its values to the cookies list instead of joining them into headers. Other headers are unchanged.
Steps to Reproduce
- On
develop(0bbc252), run the snippet above. headers["Set-Cookie"]is'session=abc; Expires=Wed, 21 Oct 2026 07:28:00 GMT, theme=dark'andcookiesonly haslang=en; Secure.
Did you run the reproduction yourself?
Yes, I ran it and saw the failure
Powertools for AWS Lambda (Python) version
3.41.0 (develop @ 0bbc252)
AWS Lambda function runtime
3.13
Packaging format used
PyPi
Debugging logs
{'Set-Cookie': 'session=abc; Expires=Wed, 21 Oct 2026 07:28:00 GMT, theme=dark', 'Content-Type': 'text/plain'}
['lang=en; Secure']
- Dominant language
- Python
- Stars
- 3.3k
- Forks
- 511
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 50
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aws-powertools/powertools-lambda-python
-
Bug: CaseInsensitiveDict (event.headers) returns True for both == and != against the same mappingOpenbug triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
aws-powertools/powertools-lambda-python#8948 ·
Maintainers usually reply within 1 day
-
Docs: child Logger without a parent uses the root log level since #8842Possibly taken @rdxrahul12 claimed this today. Opendocumentation triage
Difficulty 1/5 1-3 hours Newbie friendliness 85/100
aws-powertools/powertools-lambda-python#8935 · 3 comments ·
Maintainers usually reply within 1 day
-
Bug: validate() raises raw jmespath ParseError instead of InvalidEnvelopeExpressionError for most malformed envelopesPossibly taken @0x5t4l1n claimed this today. Openbug triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
aws-powertools/powertools-lambda-python#8918 · 2 comments ·
Maintainers usually reply within 1 day
-
Bug: SQSRecord.decoded_nested_sns_event raises KeyError on SNS messages delivered to SQSPossibly taken @hyeonsang010716 claimed this 7 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
aws-powertools/powertools-lambda-python#8913 ·
Maintainers usually reply within 1 day
-
Bug: Metrics keeps dimensions and metadata from an invocation that added no metricsPossibly taken @hyeonsang010716 claimed this 7 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
aws-powertools/powertools-lambda-python#8911 ·
Maintainers usually reply within 1 day
All issues in aws-powertools/powertools-lambda-python
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
litestar-org/sqlspec#946 ·
Maintainers usually reply within 1 day
-
area:cli area:docs Platform vdr
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NVIDIA-NeMo/Gym#7192 ·
Maintainers usually reply within 2 days
-
SofyaBotOpen
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
ai-robots-txt/ai.robots.txt#324 ·
-
[Resource]: DashbarOpenresource-submission validation-passed
Difficulty 1/5 Under an hour Newbie friendliness 78/100
hesreallyhim/awesome-claude-code#3821 · 1 comment ·
-
bug good first issue help wanted level 1 wocs
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
GianlucaBave/murmury#169 ·
Maintainers usually reply within 1 day