Skip to content

Commit

Permalink
fix: getlift#348 topic display name too long
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig McNicholas committed Jul 26, 2023
1 parent 1e786ed commit 13ea7a7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/constructs/aws/Queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,19 @@ export class Queue extends AwsConstruct {

const alarmEmail = configuration.alarm;
if (alarmEmail !== undefined) {
// generate the display name, AWS restriction is 100 chars
let displayName = `[Alert][${id}] failed jobs in dlq.`;
if (displayName.length > 100) {
// if the length is too long then try to pretty print
displayName = `[Alert][${id.substring(
0,
id.length - (displayName.length - 100 - 3)
)}...] failed jobs in dlq.`;
}

const alarmTopic = new Topic(this, "AlarmTopic", {
topicName: `${this.provider.stackName}-${id}-dlq-alarm-topic`,
displayName: `[Alert][${id}] There are failed jobs in the dead letter queue.`,
displayName,
});
new Subscription(this, "AlarmTopicSubscription", {
topic: alarmTopic,
Expand Down

0 comments on commit 13ea7a7

Please sign in to comment.