-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathapp.js
27 lines (24 loc) · 782 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: MIT-0
*/
// 1. Receive event from SQS Queue.
// 2. Log event and context object to CloudWatch Logs.
// 3. Log SQS message to CloudWatch Logs.
// 3. Return a null response.
const AWS = require('aws-sdk')
AWS.config.region = process.env.AWS_REGION
exports.handler = async (event, context) => {
try {
// Log event and context object to CloudWatch Logs
console.log("Event: ", JSON.stringify(event, null, 2));
console.log("Context: ", JSON.stringify(context, null, 2));
event.Records.forEach(record => {
const { body } = record;
console.log(body);
});
return {};
} catch (error) {
console.error(error);
throw new Error(error);
}
};