Skip to content

Commit

Permalink
Merge pull request #3525 from opengovsg/release-al2-hotfix-v5.43.2
Browse files Browse the repository at this point in the history
feat(BounceController): log SNS topic confirmation notification emails
  • Loading branch information
mantariksh authored Feb 28, 2022
2 parents 5ef1e34 + 2a28e5d commit 12b28a6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/app/modules/bounce/bounce.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ export const handleSns: ControllerHandler<
never,
ISnsNotification
> = async (req, res) => {
if (req.get('x-amz-sns-message-type') === 'SubscriptionConfirmation') {
logger.info({
meta: {
action: 'handleSns',
body: req.body,
},
message: 'Handling SNS topic confirmation notification',
})
return res.sendStatus(StatusCodes.OK)
}

const notificationResult = await BounceService.validateSnsRequest(
req.body,
).andThen(() => BounceService.safeParseNotification(req.body.Message))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ export const BouncesRouter = Router()
* Note that if anything errors in between, just return a 200
* to SNS, as the error code to them doesn't really matter.
*
* @route POST /api/v3/notifications/bounce/email
* @route POST /api/v3/notifications/bounces/email
*/
BouncesRouter.post('/email', handleSns)

0 comments on commit 12b28a6

Please sign in to comment.