Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug(cli): code.tar.gz file remains after error occurs #99

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lib/commands/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ const functionsCreateDeployment = async ({ functionId, code, activate, entrypoin
/* @param {string} entrypoint */
/* @param {string} commands */

try{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Let's not have such a big try/catch
  2. This repo is read-only and the change should be done with the sdk-generator repo.

let client = !sdk ? await sdkForProject() : sdk;
let apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
let payload = {};
Expand Down Expand Up @@ -506,7 +507,14 @@ const functionsCreateDeployment = async ({ functionId, code, activate, entrypoin
}

fs.unlinkSync(archivePath);

}
catch(err){
throw new Error(err);
}
finally{
// Remove the code tarball even if the CLI crashed.
fs.unlinkSync(archivePath);
}
if (parseOutput) {
parse(response)
success()
Expand Down Expand Up @@ -1084,4 +1092,4 @@ module.exports = {
functionsGetVariable,
functionsUpdateVariable,
functionsDeleteVariable
};
};