{"action":"created","issue":{"url":"https://api.github.com/repos/aws/aws-sdk-net/issues/1104","repository_url":"https://api.github.com/repos/aws/aws-sdk-net","labels_url":"https://api.github.com/repos/aws/aws-sdk-net/issues/1104/labels{/name}","comments_url":"https://api.github.com/repos/aws/aws-sdk-net/issues/1104/comments","events_url":"https://api.github.com/repos/aws/aws-sdk-net/issues/1104/events","html_url":"https://github.com/aws/aws-sdk-net/issues/1104","id":372609142,"node_id":"MDU6SXNzdWUzNzI2MDkxNDI=","number":1104,"title":"SNS message parsing broken","user":{"login":"Legogris","id":108799,"node_id":"MDQ6VXNlcjEwODc5OQ==","avatar_url":"https://avatars3.githubusercontent.com/u/108799?v=4","gravatar_id":"","url":"https://api.github.com/users/Legogris","html_url":"https://github.com/Legogris","followers_url":"https://api.github.com/users/Legogris/followers","following_url":"https://api.github.com/users/Legogris/following{/other_user}","gists_url":"https://api.github.com/users/Legogris/gists{/gist_id}","starred_url":"https://api.github.com/users/Legogris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Legogris/subscriptions","organizations_url":"https://api.github.com/users/Legogris/orgs","repos_url":"https://api.github.com/users/Legogris/repos","events_url":"https://api.github.com/users/Legogris/events{/privacy}","received_events_url":"https://api.github.com/users/Legogris/received_events","type":"User","site_admin":false},"labels":[{"id":130090460,"node_id":"MDU6TGFiZWwxMzAwOTA0NjA=","url":"https://api.github.com/repos/aws/aws-sdk-net/labels/Bug","name":"Bug","color":"e11d21","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-10-22T17:06:33Z","updated_at":"2018-10-24T23:17:35Z","closed_at":null,"author_association":"NONE","body":"The Message parsing relies on the parameter `SigningCertURL`: https://github.com/aws/aws-sdk-net/blob/e538f4d492fdd2980d2b907aa7b870e8d333d4a6/sdk/src/Services/SimpleNotificationService/Custom/Util/Message.cs#L73\r\n\r\nHowever, actual SNS messages provide it as `SigningCertUrl` (notice the casing difference).\r\n\r\nThis makes the instantiation always fail with legitimate messages, and since `ParseMessage` is the only public way to set these fields the current implementation is practically unusable.\r\n\r\nWe fixed it by making our own copy of this file and  replacing the JSON parsing with Newtonsoft.Json: \r\n```\r\n        public static Message ParseMessage(string messageText)\r\n        {\r\n            var message = new Message();\r\n\r\n            var settings = new JsonSerializerSettings { DateParseHandling = DateParseHandling.None };\r\n            JObject json = (JObject)JsonConvert.DeserializeObject(messageText, settings);\r\n\r\n            Func<string, string> extractField = ((fieldName) =>\r\n                {\r\n                    var val = json.GetValue(fieldName, StringComparison.OrdinalIgnoreCase)?.Value<string>();\r\n                    if (string.IsNullOrEmpty(val)) {\r\n                        return null;\r\n                    }\r\n                    return val;\r\n                });\r\n```\r\n\r\nI would make a PR, but I assume there is a reason why these libs aren't using Newtonsoft.Json (more common in the community) in the first place?"},"comment":{"url":"https://api.github.com/repos/aws/aws-sdk-net/issues/comments/432860082","html_url":"https://github.com/aws/aws-sdk-net/issues/1104#issuecomment-432860082","issue_url":"https://api.github.com/repos/aws/aws-sdk-net/issues/1104","id":432860082,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMjg2MDA4Mg==","user":{"login":"sstevenkang","id":19806888,"node_id":"MDQ6VXNlcjE5ODA2ODg4","avatar_url":"https://avatars2.githubusercontent.com/u/19806888?v=4","gravatar_id":"","url":"https://api.github.com/users/sstevenkang","html_url":"https://github.com/sstevenkang","followers_url":"https://api.github.com/users/sstevenkang/followers","following_url":"https://api.github.com/users/sstevenkang/following{/other_user}","gists_url":"https://api.github.com/users/sstevenkang/gists{/gist_id}","starred_url":"https://api.github.com/users/sstevenkang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sstevenkang/subscriptions","organizations_url":"https://api.github.com/users/sstevenkang/orgs","repos_url":"https://api.github.com/users/sstevenkang/repos","events_url":"https://api.github.com/users/sstevenkang/events{/privacy}","received_events_url":"https://api.github.com/users/sstevenkang/received_events","type":"User","site_admin":false},"created_at":"2018-10-24T23:17:35Z","updated_at":"2018-10-24T23:17:35Z","author_association":"CONTRIBUTOR","body":"There is a discrepancy between what SNS sends back to clients and what it sends to Lambda function:\r\nhttps://docs.aws.amazon.com/sns/latest/dg/json-formats.html#http-notification-json\r\nhttps://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-sns\r\n\r\nAre you by any chance using our [Lambda libraries](https://github.com/aws/aws-lambda-dotnet/tree/master/Libraries/src/Amazon.Lambda.SNSEvents) or rolling your own unarmshalling logic? \r\n\r\n"}}
{"actor":{"display_login":"sstevenkang"}}