Miserlou / Zappa

Serverless Python
https://blog.zappa.io/
MIT License
11.89k stars 1.2k forks source link

Handling non-dict SNS messages #2198

Open piotrdrazikowski opened 3 years ago

piotrdrazikowski commented 3 years ago

Description

The main SNS message handler incorrectly assumes that every message that was parsed using json.loads() without throwing an exception is of dict type, and then uses dict methods like .get() on the parsed object which eventually leads to a crash. In our case this has prevented us from sending a list of dicts, but there's more examples. This PR fixes it by handling the AttributeError exception ## GitHub Issues

https://github.com/Miserlou/Zappa/issues/1466 https://github.com/Miserlou/Zappa/issues/1864

coveralls commented 3 years ago

Coverage Status

Coverage remained the same at 72.975% when pulling 1e7d9c18ecbcf244219d14ddb80e9a690079f52e on protagonistllc:bugfix/non-dict-sns-message-handling into 542c8c60291ebc5ece03b8dd4abe9e0172715086 on Miserlou:master.