Skip to content

Commit 10d149b

Browse files
committed
fix: fail deployment when build commands exit with non-zero status code
1 parent 310a83a commit 10d149b

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

lambda/nodejs-build/index.ts

+7-11
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,12 @@ export const handler = async (event: Event, context: any) => {
4545

4646
await Promise.all(promises);
4747

48-
try {
49-
console.log(JSON.stringify(process.env));
50-
const wd = path.join(rootDir, props.workingDirectory);
51-
execSync(props.buildCommands.join(' && '), {
52-
cwd: wd,
53-
stdio: 'inherit',
54-
});
55-
} catch (e) {
56-
console.log(e);
57-
}
48+
console.log(JSON.stringify(process.env));
49+
const wd = path.join(rootDir, props.workingDirectory);
50+
execSync(props.buildCommands.join(' && '), {
51+
cwd: wd,
52+
stdio: 'inherit',
53+
});
5854

5955
// zip the artifact directory and upload it to a S3 bucket.
6056
const srcPath = path.join(rootDir, props.outputSourceDirectory);
@@ -65,7 +61,7 @@ export const handler = async (event: Event, context: any) => {
6561
await sendStatus('SUCCESS', event, context);
6662
} catch (e) {
6763
console.log(e);
68-
const err= e as Error;
64+
const err = e as Error;
6965
await sendStatus('FAILED', event, context, err.message);
7066
} finally {
7167
if (rootDir != '') {

0 commit comments

Comments
 (0)