Bug: Set-Cookie values passed as a header are comma-joined into one invalid header on HTTP API and Function URL responses
Maintainer thường phản hồi trong vòng 1 ngày
@saquibjawedbit đang làm issue này rồi.
Từ ngày 28/11/2026.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 85/100
Hướng nghiên cứu
Bắt đầu với HttpApiHeadersSerializer.serialize, hiện đang nối các giá trị của header dạng danh sách bằng dấu phẩy, và tái hiện hành vi bằng đoạn mã APIGatewayHttpResolver được cung cấp cùng với apiGatewayProxyV2Event_GET.json. Thêm hoặc cập nhật test của serializer để bao phủ các header Set-Cookie không phân biệt chữ hoa chữ thường và xác minh các giá trị được chuyển vào trường cookies của phản hồi trong khi các header khác không thay đổi. Ngoài ra, hãy kiểm tra đường dẫn tương ứng của LambdaFunctionUrlResolver và chạy bộ test chức năng liên quan.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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']
- Ngôn ngữ chính
- Python
- Star
- 3.3k
- Fork
- 511
- Merge trung bình
- 2 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 50
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của aws-powertools/powertools-lambda-python
-
Bug: CaseInsensitiveDict (event.headers) returns True for both == and != against the same mappingĐang mởbug triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
aws-powertools/powertools-lambda-python#8948 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Docs: child Logger without a parent uses the root log level since #8842Có thể đã có người làm @rdxrahul12 đã nhận hôm nay. Đang mởdocumentation triage
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
aws-powertools/powertools-lambda-python#8935 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug: validate() raises raw jmespath ParseError instead of InvalidEnvelopeExpressionError for most malformed envelopesCó thể đã có người làm @0x5t4l1n đã nhận hôm nay. Đang mởbug triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
aws-powertools/powertools-lambda-python#8918 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug: SQSRecord.decoded_nested_sns_event raises KeyError on SNS messages delivered to SQSCó thể đã có người làm @hyeonsang010716 đã nhận 7 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
aws-powertools/powertools-lambda-python#8913 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug: Metrics keeps dimensions and metadata from an invocation that added no metricsCó thể đã có người làm @hyeonsang010716 đã nhận 7 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
aws-powertools/powertools-lambda-python#8911 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của aws-powertools/powertools-lambda-python
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
litestar-org/sqlspec#946 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:cli area:docs Platform vdr
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NVIDIA-NeMo/Gym#7192 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
SofyaBotĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
ai-robots-txt/ai.robots.txt#324 ·
-
[Resource]: DashbarĐang mởresource-submission validation-passed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
hesreallyhim/awesome-claude-code#3821 · 1 bình luận ·
-
bug good first issue help wanted level 1 wocs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 92/100
GianlucaBave/murmury#169 ·
Maintainer thường phản hồi trong vòng 1 ngày