Skip to content

Update SNSEvent.Message Coding Keys #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2023
Merged

Update SNSEvent.Message Coding Keys #35

merged 1 commit into from
May 18, 2023

Conversation

hiimtmac
Copy link
Contributor

Update SNSEvent.Message coding keys to match go models & documentation

Motivation:

When trying to decode an SNSEvent as the lambda's event (using runtime 1.0.0-alpha.1), I am getting:

2023-05-18T14:51:32+0000 warning Lambda : lifecycleIteration=16 lambda handler returned an error: requestDecoding(Swift.DecodingError.keyNotFound(CodingKeys(stringValue: "SigningCertURL", intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "Records", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "Sns", intValue: nil)], debugDescription: "No value associated with key CodingKeys(stringValue: \"SigningCertURL\", intValue: nil) (\"SigningCertURL\").", underlyingError: nil)))

It seems that the model's coding keys have changed with the proper keys being SigningCertUrl and UnsubscribeUrl (as opposed to SigningCertURL and UnsubscribeURL).

https://github.com/aws/aws-lambda-go/blob/771b391678d3f54bfa38531774d656f5e0f2ab58/events/sns.go#L28
https://github.com/aws/aws-lambda-go/blob/771b391678d3f54bfa38531774d656f5e0f2ab58/events/sns.go#L30
https://docs.aws.amazon.com/lambda/latest/dg/with-sns.html

Modifications:

Update the coding key raw values for SNSEvent.Message.signingCertURL and SNSEvent.Message.unsubscribeURL

Result:

Lamda handler can now successfully decode SNSEvent in then handle(_:context:) method.

@tomerd
Copy link
Contributor

tomerd commented May 18, 2023

@swift-server-bot test this please

@tomerd tomerd enabled auto-merge (squash) May 18, 2023 17:49
@tomerd
Copy link
Contributor

tomerd commented May 18, 2023

thanks @hiimtmac

@tomerd tomerd merged commit 5912b9e into swift-server:main May 18, 2023
@hiimtmac hiimtmac deleted the fix/sns-coding-keys branch May 18, 2023 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants