Bug: S3RecordModel drops lifecycleEventData and replicationEventData
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đá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
- 82/100
Hướng nghiên cứu
Bắt đầu bằng cách đọc S3RecordModel và các trường dữ liệu của sự kiện lân cận, sau đó kiểm tra tests/events/s3EventLifecycleTransition.json và các bài kiểm thử parser dành cho bản ghi S3. Bổ sung kiểm thử để xác nhận cả hai trường dữ liệu sự kiện được giữ nguyên, bao gồm một mẫu sao chép phù hợp. Hoàn tất khi việc phân tích sự kiện S3 và S3-to-SQS giữ nguyên dữ liệu và các bài kiểm thử liên quan đều thành công.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Expected Behaviour
S3RecordModel keeps lifecycleEventData and replicationEventData when S3 sends them, the same way it keeps glacierEventData and intelligentTieringEventData. They hold the main detail of those events, like the storage class an object moved to or why a replication failed. The event message structure docs list both, and there are samples for Lifecycle transition and replication events.
Current Behaviour
The model doesn't declare either key, and Pydantic ignores keys it doesn't know, so these events parse without an error but the data isn't on the parsed record. The repo's own tests/events/s3EventLifecycleTransition.json has lifecycleEventData, and it's gone after parsing. S3SqsEventNotificationModel reuses S3Model, so S3 to SQS events lose it too.
The TypeScript parser added both in aws-powertools/powertools-lambda-typescript#5924.
Code snippet
import json
from aws_lambda_powertools.utilities.parser import parse
from aws_lambda_powertools.utilities.parser.models import S3Model
with open("tests/events/s3EventLifecycleTransition.json") as f:
event = json.load(f)
print("in event:", "lifecycleEventData" in event["Records"][0])
record = parse(event=event, model=S3Model).Records[0]
print("on parsed record:", "lifecycleEventData" in record.model_dump())
in event: True
on parsed record: False
Possible Solution
Add both as optional fields next to intelligentTieringEventData, with Field(description=...) like the rest of the model:
class S3EventRecordLifecycleTransitionEventData(BaseModel):
destinationStorageClass: str
class S3EventRecordLifecycleEventData(BaseModel):
transitionEventData: S3EventRecordLifecycleTransitionEventData
class S3EventRecordReplicationEventData(BaseModel):
replicationRuleId: str | None = None
destinationBucket: str | None = None
s3Operation: str | None = None
requestTime: str | None = None
failureReason: str | None = None
# In S3RecordModel
lifecycleEventData: S3EventRecordLifecycleEventData | None = None
replicationEventData: S3EventRecordReplicationEventData | None = None
Every replication field is optional because the docs only show the failed replication event, the same call the TypeScript fix made. This only adds fields, so nothing that parses today changes.
I'm happy to send a PR with tests and a replication fixture if that sounds good.
Steps to Reproduce
Run the snippet above from the repo root. The replication sample from the docs page loses replicationEventData the same way.
Powertools for AWS Lambda (Python) version
3.40.0
AWS Lambda function runtime
3.13
Packaging format used
PyPi
- Ngôn ngữ chính
- Python
- Star
- 3.3k
- Fork
- 511
- Merge trung bình
- 3 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 103
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
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
aws-powertools/powertools-lambda-python#8801 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug: child Logger without a level ignores its parent's log level since 3.6.0Có thể đã có người làm @saimcyber đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
aws-powertools/powertools-lambda-python#8778 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug: POWERTOOLS_IDEMPOTENCY_DISABLED set to an empty or non-boolean value crashes every invocationCó thể đã có người làm @lechakrawarthy đã nhận 11 ngày trước. Đang mởbug good first issue help wanted idempotency
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
aws-powertools/powertools-lambda-python#8728 · 4 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug: Redis layer fails the invocation instead of retrying when a record expires between SET NX and GETCó thể đã có người làm @coughlmao đã nhận 11 ngày trước. Đang mởbug good first issue help wanted idempotency
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
aws-powertools/powertools-lambda-python#8727 · 4 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug: Redis orphan lock timeout ignores expires_after_seconds and is always 10 secondsCó thể đã có người làm @CJstate đã nhận 11 ngày trước. Đang mởbug good first issue help wanted idempotency
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
aws-powertools/powertools-lambda-python#8726 · 4 bình luận · 1 người được giao ·
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ự
-
15-minutes 5-minutes algorithm any-language beginner-friendly c cpp csharp easy go good first issue hacktoberfest help wanted java javascript kotlin python rust swift typescript
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Huerte/algo-solutions-python#254 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 86/100
MichaelYcJo/SpecSeal#1543 ·
-
size/s
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
sipyourdrink-ltd/bernstein#7179 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue help wanted python up-for-grabs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
andrewsiah/agentswarm-data-tasks#309 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày