Skip to content

Commit

Permalink
fixup! [u] Route SNS notifications through a Lambda function (#5246)
Browse files Browse the repository at this point in the history
  • Loading branch information
achave11-ucsc committed Oct 28, 2023
1 parent ff84160 commit 3e9e12c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/azul/indexer/notify_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ class AzulEmailNotificationService:

def notify_group(self, subject: str, message: str) -> None:
log.info('Notifying group of event %r', trunc_ellipses(message, 256))
# Try to improve readability by adding indent
try:
# Ensure readable formatting …
body = json.loads(message)
except json.decoder.JSONDecodeError:
log.warning('Not a JSON serializable event, sending as received.')
body = message
else:
# … by deserializing with indent. However, it must happen as a
# second step (not in .loads) to avoid raising a JSONDecodeError
body = json.dumps(body, indent=4)
response = aws.ses.send_email(
FromEmailAddress=f'Azul {config.deployment_stage} Monitoring'
Expand Down
4 changes: 2 additions & 2 deletions terraform/shared/shared.tf.json.template.py
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,8 @@ def paren(s: str) -> str:
'identity': '${aws_ses_domain_identity.notify.arn}',
'name': config.qualified_resource_name('notify'),
'policy': json.dumps({
"Version": "2012-10-17",
"Statement": [
'Version': '2012-10-17',
'Statement': [
{
'Effect': 'Allow',
'Principal': {
Expand Down

0 comments on commit 3e9e12c

Please sign in to comment.