Skip to content

Commit

Permalink
Fix #4966 - Larger releases were failing to deploy (#4969)
Browse files Browse the repository at this point in the history
* Fix #4966 - Larger releases were failing to deploy

This commit fixes an issue where larger functions were not getting deployed.

`#4940` Added `await archiver.finalize()`, which meant function file contents were
being stored in-memory instead of being piped to the tmp file.

The main fix in this commit is calling `pipe` before we `await archiver.finalize()`.
  • Loading branch information
TheIronDev committed Sep 12, 2022
1 parent 65d9a45 commit 2ebefe2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1 +1,2 @@
- Add v2 Remote Config triggers to deploy (#4937).
- Fixes issue where large CF3 releases were failing to deploy (#4969)
4 changes: 2 additions & 2 deletions src/deploy/functions/prepareFunctionsUpload.ts
Expand Up @@ -45,10 +45,11 @@ export async function getFunctionsConfig(projectId: string): Promise<Record<stri
}

async function pipeAsync(from: archiver.Archiver, to: fs.WriteStream) {
from.pipe(to);
await from.finalize();
return new Promise((resolve, reject) => {
to.on("finish", resolve);
to.on("error", reject);
from.pipe(to);
});
}

Expand Down Expand Up @@ -94,7 +95,6 @@ async function packageSource(
mode: 420 /* 0o644 */,
});
}
await archive.finalize();
await pipeAsync(archive, fileStream);
} catch (err: any) {
throw new FirebaseError(
Expand Down

0 comments on commit 2ebefe2

Please sign in to comment.