Skip to content

Commit 3953785

Browse files
authored
Toolkit provides feedback when packaging without a successful build (#1472)
A previous update to the toolkit allowed it to `sam package` and `sam deploy` even if a `sam build` failed (e.g. if you have a simple NodeJS Lambda without a `package.json` file). This pops a toast to alert the user that this is occuring.
1 parent 8902746 commit 3953785

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@
419419
"AWS.samcli.deploy.general.error": "An error occurred while deploying a SAM Application. {0}",
420420
"AWS.samcli.deploy.workflow.init": "Building SAM Application...",
421421
"AWS.samcli.deploy.workflow.packaging": "Packaging SAM Application to S3 Bucket: {0}",
422+
"AWS.samcli.deploy.workflow.packaging.noBuild": "Attempting to package source template directory directly after \"sam build\" failed",
422423
"AWS.samcli.deploy.workflow.stackName.initiated": "Deploying SAM Application to CloudFormation Stack: {0}",
423424
"AWS.samcli.deploy.workflow.start": "Starting SAM Application deployment...",
424425
"AWS.samcli.deploy.workflow.success": "Successfully deployed SAM Application to CloudFormation Stack: {0}",

src/lambda/commands/deploySamApplication.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,15 @@ async function packageOperation(
167167
},
168168
buildSuccessful: boolean
169169
): Promise<void> {
170+
if (!buildSuccessful) {
171+
vscode.window.showInformationMessage(
172+
localize(
173+
'AWS.samcli.deploy.workflow.packaging.noBuild',
174+
'Attempting to package source template directory directly since "sam build" failed'
175+
)
176+
)
177+
}
178+
170179
getLogger('channel').info(
171180
localize(
172181
'AWS.samcli.deploy.workflow.packaging',

0 commit comments

Comments
 (0)