Skip to content

Commit d408928

Browse files
committed
lambda-sns-terraform: Update SDK to v3 for nodejs22.x runtime
1 parent 205a7a3 commit d408928

File tree

1 file changed

+7
-5
lines changed
  • lambda-sns-terraform/src

1 file changed

+7
-5
lines changed

lambda-sns-terraform/src/app.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
* SPDX-License-Identifier: MIT-0
33
*/
44

5-
const AWS = require('aws-sdk')
6-
AWS.config.region = process.env.AWS_REGION
7-
const sns = new AWS.SNS({apiVersion: '2012-11-05'})
5+
const { SNSClient, PublishCommand } = require('@aws-sdk/client-sns')
6+
7+
const snsClient = new SNSClient({
8+
region: process.env.AWS_REGION
9+
})
810

911
// The Lambda handler
1012
exports.handler = async (event) => {
@@ -16,6 +18,6 @@ exports.handler = async (event) => {
1618
}
1719

1820
// Send to SNS
19-
const result = await sns.publish(params).promise()
21+
const result = await snsClient.send(new PublishCommand(params))
2022
console.log(result)
21-
}
23+
}

0 commit comments

Comments
 (0)