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
So i am processing SQS messages in aws lambda. Those messages come into my queue from s3 as a S3Notification event.
Each message has a body field wich is populated with the s3 event as a JSON string.
I wanted to decode that json string to a AWSLambdaEvents.S3.Event object using the following code:
Swift & OS version (output of swift --version && uname -a)
Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)
Target: x86_64-apple-darwin20.3.0
Darwin machine_name.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64
The text was updated successfully, but these errors were encountered:
@mufumade Thanks for raising this and the vast error description. Since you have already done most of the work, are you maybe interested in providing a patch pr as well? I'd be happy to accept it.
Expected behavior
So i am processing SQS messages in aws lambda. Those messages come into my queue from s3 as a S3Notification event.
Each message has a body field wich is populated with the s3 event as a JSON string.
I wanted to decode that json string to a
AWSLambdaEvents.S3.Event
object using the following code:Actual behavior
expression unexpectedly raised an error: Swift.DecodingError.keyNotFound(CodingKeys(stringValue: "size", intValue: nil)
This is due to a few missing fields in the s3 event if the event is
s3:ObjectRemoved:DeleteMarkerCreated
orObjectRemoved:Delete
.The following shows a real s3 object removed event:
Unfortunately this behavior is not documented by AWS. There is also a discussion on stackoverflow
Steps to reproduce
This could be easily fixed by changing the
size
field to an optional.SwiftAWSLambdaRuntime version/commit hash
SwiftAWSLambdaRuntime version: 0.4.0
Swift & OS version (output of
swift --version && uname -a
)Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)
Target: x86_64-apple-darwin20.3.0
Darwin machine_name.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64
The text was updated successfully, but these errors were encountered: