UNPKG

serverless-spy

Version:

CDK-based library for writing elegant integration tests on AWS serverless architecture and an additional web console to monitor events in real time.

30 lines (28 loc) 668 B
const __dirname = import.meta.dirname; import { SpyEventSender } from "../common/SpyEventSender.mjs"; //#region functions/sendMessage.ts const handler = async (event) => { const spyEventSender = new SpyEventSender({ scope: process.env["SSPY_ROOT_STACK"], iotEndpoint: process.env["SSPY_IOT_ENDPOINT"] }); try { await spyEventSender.connect(); await spyEventSender.publishSpyEvent(event); } catch (e) { console.error(e); return { statusCode: 500, body: e?.stack }; } finally { await spyEventSender.close(); } return { statusCode: 200, body: "Data sent." }; }; //#endregion export { handler }; //# sourceMappingURL=sendMessage.mjs.map