add event debugging

This commit is contained in:
Elizabeth Cray 2024-10-04 20:14:22 -04:00
parent 4595b2b396
commit d443a1090f

View File

@ -6,15 +6,17 @@ import {
GetSecretValueCommand, GetSecretValueCommand,
} from "@aws-sdk/client-secrets-manager"; } from "@aws-sdk/client-secrets-manager";
export const handler = async (event) => { export const handler = async (event) => {
console.info("Event: ", event);
let result = "did not send"; let result = "did not send";
if (event.subject.includes("You have deliveries") || event.subject.includes("You have a delivery")) { if (event.subject.includes("You have deliveries") || event.subject.includes("You have a delivery")) {
// Trigger home notification // Trigger home notification
console.info("Matched Subject, pull key"); console.info("Matched Subject");
const command = `ssh ${process.env.INTERNAL_HOST} "/usr/bin/tmux neww -d \"/usr/bin/mplayer '${process.env.INTERNAL_FILE}'\""`; const command = `ssh ${process.env.INTERNAL_HOST} "/usr/bin/tmux neww -d \"/usr/bin/mplayer '${process.env.INTERNAL_FILE}'\""`;
const tempFile = `./${v4()}.key`; const tempFile = `./${v4()}.key`;
const keyClient = new SecretsManagerClient({ region: "us-west-2" }); const keyClient = new SecretsManagerClient({ region: "us-west-2" });
let keyResponse; let keyResponse;
try { try {
console.info("Get Key");
keyResponse = await keyClient.send(new GetSecretValueCommand({ keyResponse = await keyClient.send(new GetSecretValueCommand({
SecretId: process.env.TRIGGER_SECRET SecretId: process.env.TRIGGER_SECRET
})); }));