The user wlandgraf is troubleshooting bounced emails from Amazon SES/SNS in Discourse. While AWS notifications are reaching the /webhooks/aws endpoint and Discourse responds with a 200 status, the emails do not appear in the list of bounced emails. The user identifies a Encoding::UndefinedConversionError in the logs, suggesting an issue with processing the SNS message, possibly due to encoding mismatch when passing JSON to Sidekiq. The user notes that other webhook handlers process bounces directly, but the AWS handler enqueues a job, which may be contributing to the problem. wlandgraf further investigates, linking the error to a known issue in the Sidekiq backend, and questions the design choice of queuing the AWS bounce processing instead of handling it immediately.
I was aware that Discourse offers an endpoint to handle SNS notifications from Amazon SES. The endpoint is /webhooks/aws, and here is where I got aware of it:
Everything is “almost” working. I can see that AWS is sending the notifications to that endpoint, via CloudWatch log. I also see that Discourse is responding the notification with successful status code (200), after I configured it to send the raw message.
However, the e-mail doesn’t appear in the list of “Bounced” e-mails in Discourse. Is there anything else I should do? How could I check some log that shows me what the endpoint effectively did after receiving the notification from AWS?
Discourse is passing the JSON received from Amazon SNS directly to Sidekiq, which in turn is not being able to handle it properly.
I also wonder why in webhooks_controller.rb all webhooks are calling process_bounce directly and the aws one is the only one which is enqueuing a job for processing it?