Skip to content

Commit cf755df

Browse files
authored
fix(amplify-provider-awscloudformation): prevent abrupt closing of CLI (#1655)
Amplify CLI tries to open AWS Console links when adding new user. In some windows system, opening browser fail and cause the CLI to terminate abruptly. Handling failure gracefully
1 parent 070d4f5 commit cf755df

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/amplify-provider-awscloudformation/lib/setup-new-user.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function run(context) {
1818
context.print.info('');
1919
context.print.info('Sign in to your AWS administrator account:');
2020
context.print.info(chalk.green(constants.AWSAmazonConsoleUrl));
21-
opn(constants.AWSAmazonConsoleUrl, { wait: false });
21+
opn(constants.AWSAmazonConsoleUrl, { wait: false }).catch(() => {});
2222

2323
return context.amplify.pressEnterToContinue.run({ message: 'Press Enter to continue' })
2424
.then(() => {
@@ -45,7 +45,7 @@ function run(context) {
4545
const deepLinkURL = constants.AWSCreateIAMUsersUrl.replace('{userName}', answers.userName).replace('{region}', answers.region);
4646
context.print.info('Complete the user creation using the AWS console');
4747
context.print.info(chalk.green(deepLinkURL));
48-
opn(deepLinkURL, { wait: false });
48+
opn(deepLinkURL, { wait: false }).catch(() => {});
4949
return context.amplify.pressEnterToContinue.run({ message: 'Press Enter to continue' });
5050
})
5151
.then(() => {

0 commit comments

Comments
 (0)