Closed Bug 1746112 Opened 2 years ago Closed 2 years ago

AWS is complaining about too many failures. SNS notification format seems to have changed

Categories

(bugzilla.mozilla.org :: Email Notifications, defect, P1)

Tracking

()

RESOLVED FIXED

People

(Reporter: dkl, Assigned: dkl)

Details

The following error is being logged since Dec 10th so the format has changed and we need to change how we check it.

Error in SES Handler: Reference {"complaint" => {"arrivalDate" => "2021-12-14T17:25:51.154Z"...} did not pass type constraint "ComplaintNotification" (in $_[1]) at /app/Bugzilla/App/SES.pm line 165 "ComplaintNotification" is a subtype of "Dict[complaint=>Dict[complainedRecipients=>ComplainedRecipients,complaintFeedbackType=>Str,slurpy Any],slurpy Any]" Reference {"complaint" => {"arrivalDate" => "2021-12-14T17:25:51.154Z"...} did not pass type constraint "Dict[complaint=>Dict[complainedRecipients=>ComplainedRecipients,complaintFeedbackType=>Str,slurpy Any],slurpy Any]" (in $_[1]) "Dict[complaint=>Dict[complainedRecipients=>ComplainedRecipients,complaintFeedbackType=>Str,slurpy Any],slurpy Any]" constrains value at key "complaint" of hash with "Dict[complainedRecipients=>ComplainedRecipients,complaintFeedbackType=>Str,slurpy Any]" Reference {"arrivalDate" => "2021-12-14T17:25:51.154Z","complainedReci...} did not pass type constraint "Dict[complainedRecipients=>ComplainedRecipients,complaintFeedbackType=>Str,slurpy Any]" (in $_[1]->{"complaint"}) "Dict[complainedRecipients=>ComplainedRecipients,complaintFeedbackType=>Str,slurpy Any]" requires key "complaintFeedbackType" to appear in hash

Once I get a hold of a full copy of the JSON that is being sent I can update our end and deploy a fix.

It doesn't appear to be a change from AWS's side.

https://docs.aws.amazon.com/ses/latest/DeveloperGuide/notification-examples.html

A "Complaint Notification Without a Feedback Report" would trigger this error as it doesn't contain complaintFeedbackType:

      "complaint":{
         "complainedRecipients":[
            {
               "emailAddress":"richard@example.com"
            }
         ],
         "timestamp":"2016-01-27T14:59:38.237Z",
         "feedbackId":"0000013786031775-fea503bc-7497-49e1-881b-a0379bb037d3-000000"
      },

The handling code supports this:

my $reason  = $notification->{complaint}->{complaintFeedbackType} // 'unknown';

However the strict schema verification which was added later doesn't treat complaintFeedbackType as optional.

Looks like a simple fix:

-    complaintFeedbackType => Str,
+    complaintFeedbackType => Optional [Str],
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.