From a59def6a21c56892e7a76ca1226389ecba935013 Mon Sep 17 00:00:00 2001 From: Liz/Alice Cray Date: Fri, 4 Oct 2024 19:44:42 -0400 Subject: [PATCH] Stream management fix --- index.mjs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/index.mjs b/index.mjs index f03b9ab..f85c36a 100644 --- a/index.mjs +++ b/index.mjs @@ -31,10 +31,8 @@ export const handler = async (event) => { console.warn(error); result = JSON.stringify(error); } - stream.on('close', (code, signal) => { - // COMPLETE - console.info("Trigger completed", code, signal) - result = code; + stream.on('end', () => { + console.info("Stream ended"); const response = { statusCode: 200, body: { @@ -42,6 +40,11 @@ export const handler = async (event) => { }, }; return response; + }); + stream.on('close', (code, signal) => { + // COMPLETE + console.info("Trigger completed", code, signal) + result = code; }).stderr.on('data', (data) => { // STDERR console.warn(data);