Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 28 | 1x 4x 4x 4x 4x 4x 3x 3x 1x 2x 2x 2x 1x 1x 1x 4x | import { Handler } from "aws-lambda";
import { FAILED, send, SUCCESS } from "cfn-response-async";
export const handler: Handler = async (event, _, callback) => {
const response = {
statusCode: 200,
};
let errorResponse = null;
const responseData = {};
try {
const cfnEvent = event.Context.Execution.Input?.cfnEvent;
const cfnContext = event.Context.Execution.Input?.cfnContext;
if (!cfnEvent) {
console.log("No cfnEvent. No one to notify. Will proceed");
} else {
console.log("Sending notification to CFN... Success: " + event.Success);
const result = event.Success ? SUCCESS : FAILED;
await send(cfnEvent, cfnContext, result, responseData, "static");
}
} catch (error: any) {
console.log({ error });
response.statusCode = 500;
errorResponse = error;
} finally {
callback(errorResponse, response);
}
};
|