From 1a3df985e9096229bc2909921b4974680e12be2a Mon Sep 17 00:00:00 2001 From: Denis DelGrosso <85250797+ddelgrosso1@users.noreply.github.com> Date: Tue, 25 Oct 2022 11:33:47 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20remove=20async=20from=20final=20function?= =?UTF-8?q?=20which=20causes=20double=20invocation=20=E2=80=A6=20(#2094)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: remove async from final function which causes double invocation of callback * add catch clause --- src/file.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/file.ts b/src/file.ts index 8b02905ca..49c673337 100644 --- a/src/file.ts +++ b/src/file.ts @@ -1530,12 +1530,15 @@ class File extends ServiceObject { } const handoffStream = new PassThrough({ - final: async cb => { + final: cb => { // Preserving `onComplete`'s ability to // destroy `throughStream` before pipeline // attempts to. - await onComplete(null); - cb(); + onComplete(null) + .then(() => { + cb(); + }) + .catch(cb); }, });