From 7b65adeaaa744460ad9d95df7b780bd5c1f26449 Mon Sep 17 00:00:00 2001 From: Colt McKissick Date: Wed, 26 Nov 2025 11:58:17 -0500 Subject: [PATCH] fix: Update email processor ses options to match v2 Signed-off-by: Colt McKissick --- .changeset/fancy-wasps-check.md | 5 +++++ .../config.d.ts | 6 +----- .../NotificationsEmailProcessor.test.ts | 8 +++----- .../src/processor/NotificationsEmailProcessor.ts | 16 ++++++++++------ 4 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 .changeset/fancy-wasps-check.md diff --git a/.changeset/fancy-wasps-check.md b/.changeset/fancy-wasps-check.md new file mode 100644 index 0000000000..fb7fbfed73 --- /dev/null +++ b/.changeset/fancy-wasps-check.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-notifications-backend-module-email': minor +--- + +Changes ses configuration keys to match new configuration options in SES SDK V2 diff --git a/plugins/notifications-backend-module-email/config.d.ts b/plugins/notifications-backend-module-email/config.d.ts index 7116826c5d..f73ef1074b 100644 --- a/plugins/notifications-backend-module-email/config.d.ts +++ b/plugins/notifications-backend-module-email/config.d.ts @@ -136,14 +136,10 @@ export interface Config { * Optional SES config for mail options. Allows for delegated sender */ sesConfig?: { - /** - * ARN of the identity to use as the source of the email - */ - sourceArn?: string; /** * ARN of the identity to use for the "From"/sender address of the email */ - fromArn?: string; + fromEmailAddressIdentityArn?: string; /** * Name of the configuration set to use when sending email via ses */ diff --git a/plugins/notifications-backend-module-email/src/processor/NotificationsEmailProcessor.test.ts b/plugins/notifications-backend-module-email/src/processor/NotificationsEmailProcessor.test.ts index ebe1b90f35..4ebc5d40a8 100644 --- a/plugins/notifications-backend-module-email/src/processor/NotificationsEmailProcessor.test.ts +++ b/plugins/notifications-backend-module-email/src/processor/NotificationsEmailProcessor.test.ts @@ -458,9 +458,7 @@ describe('NotificationsEmailProcessor', () => { sender: 'backstage@backstage.io', replyTo: 'no-reply@backstage.io', sesConfig: { - sourceArn: - 'arn:aws:ses:us-west-2:123456789012:identity/example.com', - fromArn: + fromEmailAddressIdentityArn: 'arn:aws:ses:us-west-2:123456789012:identity/example.com', }, }, @@ -497,8 +495,8 @@ describe('NotificationsEmailProcessor', () => { text: 'https://example.org/notifications', to: 'mock@backstage.io', ses: { - SourceArn: 'arn:aws:ses:us-west-2:123456789012:identity/example.com', - FromArn: 'arn:aws:ses:us-west-2:123456789012:identity/example.com', + FromEmailAddressIdentityArn: + 'arn:aws:ses:us-west-2:123456789012:identity/example.com', }, }); }); diff --git a/plugins/notifications-backend-module-email/src/processor/NotificationsEmailProcessor.ts b/plugins/notifications-backend-module-email/src/processor/NotificationsEmailProcessor.ts index eadfe7747e..bec19e77e8 100644 --- a/plugins/notifications-backend-module-email/src/processor/NotificationsEmailProcessor.ts +++ b/plugins/notifications-backend-module-email/src/processor/NotificationsEmailProcessor.ts @@ -45,6 +45,7 @@ import { DefaultAwsCredentialsManager } from '@backstage/integration-aws-node'; import { NotificationTemplateRenderer } from '../extensions'; import Mail from 'nodemailer/lib/mailer'; import pThrottle from 'p-throttle'; +import { SendEmailCommandInput } from '@aws-sdk/client-sesv2'; export class NotificationsEmailProcessor implements NotificationProcessor { private transporter: any; @@ -307,19 +308,22 @@ export class NotificationsEmailProcessor implements NotificationProcessor { return contentParts.join('\n\n'); } - private async getSesOptions() { + private async getSesOptions(): Promise< + Partial | undefined + > { if (!this.sesConfig) { return undefined; } - const ses: Record = {}; - const sourceArn = this.sesConfig.getOptionalString('sourceArn'); - const fromArn = this.sesConfig.getOptionalString('fromArn'); + const ses: Partial = {}; + const fromEmailAddressIdentityArn = this.sesConfig.getOptionalString( + 'fromEmailAddressIdentityArn', + ); const configurationSetName = this.sesConfig.getOptionalString( 'configurationSetName', ); - if (sourceArn) ses.SourceArn = sourceArn; - if (fromArn) ses.FromArn = fromArn; + if (fromEmailAddressIdentityArn) + ses.FromEmailAddressIdentityArn = fromEmailAddressIdentityArn; if (configurationSetName) ses.ConfigurationSetName = configurationSetName; return Object.keys(ses).length > 0 ? ses : undefined;