Skip to content

Commit 8dbd3d9

Browse files
Fix Pyright error 'key' is not a known attribute of 'None'.
1 parent c4050ad commit 8dbd3d9

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

ops/services/02-eft/lambda_src/sftp_outbound_transfer/sftp_outbound_transfer.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,11 @@ def handler(event: dict[Any, Any], context: LambdaContext) -> None: # noqa: ARG
338338
raise ValueError("Invalid invocation event, no records")
339339

340340
for s3_record in s3_event_records:
341+
342+
if not (s3_data := s3_record.s3) or not (s3_object := s3_data.object):
343+
logger.error("Skipping record: 's3.object' data is missing or None")
344+
continue
345+
341346
s3_event_time = s3_record.eventTime.astimezone(UTC)
342347
s3_object_key = unquote_plus(s3_record.s3.object.key)
343348
s3_event_name = s3_record.eventName

0 commit comments

Comments
 (0)