FIX: SES webhook wasn't parsing the message

FIX: SES webhook wasn’t parsing the message

diff --git a/app/jobs/regular/confirm_sns_subscription.rb b/app/jobs/regular/confirm_sns_subscription.rb
index f4815df..0d489c2 100644
--- a/app/jobs/regular/confirm_sns_subscription.rb
+++ b/app/jobs/regular/confirm_sns_subscription.rb
@@ -4,7 +4,7 @@ module Jobs
     sidekiq_options retry: false
 
     def execute(args)
-      return unless raw  = args[:raw].presence
+      return unless raw = args[:raw].presence
       return unless json = args[:json].presence
       return unless subscribe_url = json["SubscribeURL"].presence
 
diff --git a/app/jobs/regular/process_sns_notification.rb b/app/jobs/regular/process_sns_notification.rb
index 7a3eadb..ab26c25 100644
--- a/app/jobs/regular/process_sns_notification.rb
+++ b/app/jobs/regular/process_sns_notification.rb
@@ -4,11 +4,17 @@ module Jobs
     sidekiq_options retry: false
 
     def execute(args)
-      return unless raw  = args[:raw].presence
+      return unless raw = args[:raw].presence
       return unless json = args[:json].presence
-
       return unless message = json["Message"].presence
-      return unless message["notificationType"] == "Bounce"
+
+      message = begin
+        JSON.parse(message)
+      rescue JSON::ParserError
+        nil
+      end
+
+      return unless message && message["notificationType"] == "Bounce"
       return unless message_id = message.dig("mail", "messageId").presence
       return unless bounce_type = message.dig("bounce", "bounceType").presence

GitHub sha: 31e06dbc

This commit has been mentioned on Discourse Meta. There might be relevant details there: