aws-lambda-ses-forwarder icon indicating copy to clipboard operation
aws-lambda-ses-forwarder copied to clipboard

Silently fails if forwarding does not work

Open a-bali opened this issue 5 years ago • 4 comments

Currently this setup seems to just silently swallow emails that, for whatever reason, cannot be forwarded - for example due to exceeding the 10mb limit for the message size. The mail gets successfully saved on S3 but neither the original sender nor the receiver is notified that the email could not be forwarded.

For the time being, I circumvented this with setting up a DLQ for the Lambda function which sends notification via SNS.

I wonder if it would be possible to somehow improve this e.g. by the following:

  1. Delivering a truncated email to the recipient, indicating that it was truncated due to AWS limits and the full message is available in S3 or (possibly more appropriate for other types of failure)
  2. Bounce to the original sender indicating that the mail could not be delivered.

a-bali avatar Oct 11 '18 20:10 a-bali

Thanks for posting on the DLQ resource approach. You're right that there is no built-in notification to the original sender or recipient.

However I would not say the script silently fails. Two ways to get debugging information and trigger actions if the forwarding fails:

  1. Use a Cloudwatch Alarm configured to watch for a Lambda Error associated with this function and/or configured to watch for a SES Publish Failure associated with the related SES rule. This alarm can send an email notification to a predefined list of recipients.
  2. Check Cloudwatch Logs for information about why a message failed, including errors returned when a message exceeds the 10 MB limit.

arithmetric avatar Dec 08 '18 18:12 arithmetric

failed deliveries should be reported back to the sender, that currently is not working

ekcrisp avatar Jan 09 '19 19:01 ekcrisp

The topic is interesting. I've poster another issue pretty much similar, because when the function fails to forward the mail, the error is not logged in Cloudwatch

kevbarns avatar Jul 24 '19 08:07 kevbarns

I solved a similar "silently fails" issue by finding that my forwarding address had been black-listed by SES (during testing). Nothing shows in Cloudwatch. When I submitted a "Suppression List Removal" SES confirmed the address had been suppressed. After this it all worked.

GeoffState avatar Jul 30 '19 09:07 GeoffState