aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.82k stars 820 forks source link

consolidate messaging when exiting (ctrl+c) out of an `add <category>` flow #11096

Open josefaidt opened 2 years ago

josefaidt commented 2 years ago

Before opening, please confirm:

How did you install the Amplify CLI?

pnpm

If applicable, what version of Node.js are you using?

v18.7.0

Amplify CLI Version

10.0.0

What operating system are you using?

mac

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

n/a

Amplify Categories

Not applicable

Amplify Commands

Not applicable

Describe the bug

When exiting out of add <category> flows using ctrl+c, the Amplify CLI presents different behaviors between the categories. Some are logging an error and some simply exit

aws-amplify/reproductions/8441 
➜  amplify add storage
? Select from one of the below mentioned services: (Use arrow keys)
❯ Content (Images, audio, video, etc.) 
  NoSQL Database 

aws-amplify/reproductions/8441 
➜  amplify add storage
✖ Provide a friendly name for your resource that will be used to label this category in the project: · s3b84fc593
🛑 An error occurred when adding the storage resource

aws-amplify/reproductions/8441 
➜  amplify add api
✖ Provide a friendly name for your resource to be used as a label for this category in the project: · api844118b0
🛑 There was an error adding the API resource

aws-amplify/reproductions/8441 
➜  amplify add notifications
? Choose the push notification channel to enable. APNS

An Amazon Pinpoint project will be created for notifications.
? Provide your pinpoint resource name:  (8441RLxis) 

aws-amplify/reproductions/8441 
➜  amplify add auth
Using service: Cognito, provided by: awscloudformation

 The current configured provider is Amazon Cognito. 

 Do you want to use the default authentication and security configuration? Default configuration
 Warning: you will not be able to edit these selections. 
 How do you want users to be able to sign in? (Use arrow keys)
❯ Username 
  Email 
  Phone Number 
  Email or Phone Number 
  I want to learn more. 

aws-amplify/reproductions/8441 
➜  amplify add function
? Select which capability you want to add: (Use arrow keys)
❯ Lambda function (serverless function) 
  Lambda layer (shared code & resource used across functions) 

Expected behavior

either

Reproduction steps

  1. amplify init -y
  2. amplify add storage
  3. select "Content..." for S3
  4. exit/ctrl+c from flow

GraphQL schema(s)

```graphql # Put schemas below this line ```

Project Identifier

No response

Log output

``` # Put your logs below this line ```

Additional information

No response

ykethan commented 2 years ago

reproduced this in my application and observed the inconsistencies in error message provided when exiting early. Note: In addition to this when adding a custom resource using amplify add custom and exiting at Provide a name for your custom resource will result in amplify generating a report with a identifier.

image

marking as bug