Skip to content

Commit

Permalink
fix(sns): add region parameter to helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
hassankhan committed Nov 10, 2018
1 parent 62785e6 commit 308369e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/aws/sns/createSnsTopic.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import AWS from 'aws-sdk';

export default async (topicName: string) => {
const sns = new AWS.SNS();
export default async (topicName: string, region = 'us-east-1') => {
const sns = new AWS.SNS({ region });

const params = {
Name: topicName,
Expand Down
8 changes: 6 additions & 2 deletions src/aws/sns/publishSnsMessage.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import AWS from 'aws-sdk';

export default async (topicName: string, message: string) => {
const sns = new AWS.SNS();
export default async (
topicName: string,
message: string,
region = 'us-east-1',
) => {
const sns = new AWS.SNS({ region });

const listTopicsResponse = await sns.listTopics().promise();

Expand Down
4 changes: 2 additions & 2 deletions src/aws/sns/removeSnsTopic.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import AWS from 'aws-sdk';

export default async (topicName: string) => {
const sns = new AWS.SNS();
export default async (topicName: string, region = 'us-east-1') => {
const sns = new AWS.SNS({ region });

const listTopicsResponse = await sns.listTopics().promise();
if (!listTopicsResponse || !listTopicsResponse.Topics) {
Expand Down

0 comments on commit 308369e

Please sign in to comment.