aws-amplify / amplify-category-api

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development. This plugin provides functionality for the API category, allowing for the creation and management of GraphQL and REST based backends for your amplify project.
https://docs.amplify.aws/
Apache License 2.0
89 stars 77 forks source link

Drop and recreate a DynamoDB causes cloudformation to fail because the Stream Output is being used by a Function #2399

Closed SteveJamesDev closed 6 months ago

SteveJamesDev commented 7 months ago

How did you install the Amplify CLI?

yarn

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

Node 20

Amplify CLI Version

12.10.1

What operating system are you using?

Macv

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

Nope (only to resolve the problem)

Describe the bug

I had a model

type Message @model {
    tenantId: ID! @primaryKey(sortKeyFields: ["id"])
    id: ID!
    name:  String!
    p:  AWSJSON!
}

I changed the schema to

type Message @model {
    tenantId: ID! @primaryKey(sortKeyFields: ["id", "projectId"])
    id: ID!
    projectId: ID!
    name:  String!
    p:  AWSJSON!
}

This obviously requires Cloudformation to Drop and Recreate the DynamoDB table

I also have a function that is set to be triggered by a STREAM of that model

Cloud formation crashes with the following error

Embedded stack arn:aws:cloudformation:ap-southeast-2:396657583517:stack/amplify-iteri-demo-203527-apiiteriGQL-GBSFY1SW0HTN-Message-HM1W4VYDPDZV/470f0e40-b362-11ee-8514-06eb4b01ffad was not successfully updated. Currently in UPDATE_ROLLBACK_IN_PROGRESS with reason: Export sigqknpmbfande54vpnzyjdvvm:GetAtt:MessageTable:StreamArn cannot be deleted as it is in use by amplify-iteri-demo-203527-functioniteriMessageOnCreate-1K9682GYH6R3D

I guess the stream needs to be removed and recreated for this to work

Expected behavior

It shouldn't crash

Reproduction steps

See bug description

Project Identifier

N/A

Log output

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

Additional information

No response

Before submitting, please confirm:

ykethan commented 7 months ago

Hey, thanks for raising this! From the error message, it appears you may need to remove the streaming Lambda function, then push. For confirmation and better assistance, I am going to transfer this over to our API repository.

AnilMaktala commented 7 months ago

Hey @SteveJamesDev, According to the error message, you must remove the model dependency from the function prior to deleting the model. Let us know if it resolves your issue.

AnilMaktala commented 6 months ago

Hey 👋 , This issue is being closed due to inactivity. If you are still experiencing the same problem and need further assistance, please feel free to leave a comment. This will enable us to reopen the issue and provide you with the necessary support.

github-actions[bot] commented 6 months ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.