diff --git a/packages/graphql-mesh-server/assets/handlers/notify-sns.ts b/packages/graphql-mesh-server/assets/handlers/notify-sns.ts index 8a9c7b96..f6f40dad 100644 --- a/packages/graphql-mesh-server/assets/handlers/notify-sns.ts +++ b/packages/graphql-mesh-server/assets/handlers/notify-sns.ts @@ -1,7 +1,7 @@ import { PublishCommand, SNSClient } from "@aws-sdk/client-sns"; import { SNSEvent } from "aws-lambda"; -const client = new SNSClient({ region: process.env.AWS_REGION }); +const client = new SNSClient({ region: process.env.REGION }); export const handler = async (event: SNSEvent): Promise => { const record = event.Records[0]; diff --git a/packages/graphql-mesh-server/lib/graphql-mesh-server.ts b/packages/graphql-mesh-server/lib/graphql-mesh-server.ts index f0e2bd00..24237c11 100644 --- a/packages/graphql-mesh-server/lib/graphql-mesh-server.ts +++ b/packages/graphql-mesh-server/lib/graphql-mesh-server.ts @@ -81,6 +81,10 @@ export type MeshHostingProps = { * ARN of the SNS Topic to send deployment notifications to */ notificationArn?: string; + /** + * Region of the SNS Topic that deployment notifications are sent to + */ + notificationRegion?: string; /** * List of IPv4 addresses to block */ @@ -186,6 +190,7 @@ export class MeshHosting extends Construct { repository: this.repository, service: this.service, notificationArn: props.notificationArn, + notificationRegion: props.notificationRegion, }); new PerformanceMetrics(this, "cloudwatch", { diff --git a/packages/graphql-mesh-server/lib/pipeline.ts b/packages/graphql-mesh-server/lib/pipeline.ts index c0fa72eb..4fb80b53 100644 --- a/packages/graphql-mesh-server/lib/pipeline.ts +++ b/packages/graphql-mesh-server/lib/pipeline.ts @@ -1,4 +1,4 @@ -import { Duration } from "aws-cdk-lib"; +import { Duration, Stack } from "aws-cdk-lib"; import { Artifact, Pipeline } from "aws-cdk-lib/aws-codepipeline"; import { Repository } from "aws-cdk-lib/aws-ecr"; import { FargateService } from "aws-cdk-lib/aws-ecs"; @@ -38,6 +38,11 @@ export interface CodePipelineServiceProps { * ARN of the SNS Topic to send deployment notifications to */ notificationArn?: string; + + /** + * AWS Region the SNS topic is deployed in + */ + notificationRegion?: string; } export class CodePipelineService extends Construct { @@ -115,6 +120,7 @@ export class CodePipelineService extends Construct { timeout: Duration.seconds(10), environment: { SNS_TOPIC: props.notificationArn, + REGION: props.notificationRegion || Stack.of(this).region, }, });