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.

20 lines (17 loc) 551 B
import { SpyEventSender } from '../common/SpyEventSender'; export const handler = async (event: any) => { 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 as Error)?.stack }; } finally { await spyEventSender.close(); } return { statusCode: 200, body: 'Data sent.' }; };