aws-amplify / amplify-cli

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

unexpected error and stack trace on `amplify update storage` > NoSQL when no storage resource exists #11159

Open josefaidt opened 1 year ago

josefaidt commented 1 year ago

Before opening, please confirm:

How did you install the Amplify CLI?

pnpm

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

18

Amplify CLI Version

10.2.3

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

aws-amplify/reproductions/storagetest 
➜  amplify update storage
? Select from one of the below mentioned services: NoSQL Database
TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at updateWalkthrough (/snapshot/repo/build/node_modules/@aws-amplify/amplify-category-storage/lib/provider-utils/awscloudformation/service-walkthroughs/dynamoDb-walkthrough.js:96:10)
    at Object.updateResource (/snapshot/repo/build/node_modules/@aws-amplify/amplify-category-storage/lib/provider-utils/awscloudformation/index.js:103:10)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Object.executeAmplifyCommand (/snapshot/repo/build/node_modules/@aws-amplify/amplify-category-storage/lib/index.js:282:3)
    at async executePluginModuleCommand (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:142:5)
    at async executeCommand (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:40:9)
    at async Object.run (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/index.js:153:5)
🛑 An error occurred when updating the storage resource

Expected behavior

Amplify CLI gracefully errors with guidance

aws-amplify/reproductions/storagetest 
➜  amplify update storage
🛑 No storage resource exists. To get started, run `amplify add storage` https://docs.amplify.aws/cli/storage/overview/#setup-a-new-storage-resource

Reproduction steps

  1. amplify init -y
  2. amplify update storage > NoSQL
  3. observe error

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 1 year ago

Marking this as bug. Note: the error occurs when creating a new project in a empty folder and then running amplify update storage.