aws-amplify / aws-amplify/amplify-hosting

Removed elements from data schema do not get removed from amplify_outputs.json after redeployment

Open
#4,058 0 comments 0 reactions 0 assignees View on GitHub
console pending-triage
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

### Environment information

```plain text
-
```

### Describe the bug

I'm facing this issue over and over again.

I remove something from the schema and adopt the code accordingly, commit and push, redownload the amplify_outputs,json after redeployment and the all api operations fail because of failed schema validations for elements that have been removed from the schema, but are still in the amplify_outputs.json.

This does not seem to appear if I add new elements to the schema, but mostly when removing elements from it. And maybe it is related to the fact, that I was changing elements in regard to the partition key.

For example I had a custom part key "customKey: a.id().required()" and ".identifier(["customKey])" and when I removed it, the schema should default back to using "id" which gets automatically populated server-side. But instead the ouputs json just keeps the old schema, even after several redeployments. So the schema definition in the outputs is not the same as in the resource.ts, including the partition key definition.

But the same goes, if I remove a whole model from the schema. It just stays in the amplify_outputs.json, though the corresponding table gets deleted during deployment.

I can actually confirm now, that the amplify_outputs.json, does currently not change at all after redeployment. I added a test property to the model, which does not get adopted into the json. I don't know why, but whenever I try to download the json, it's just the same unchanged json from several deployments ago. Not a single of the many changes to the schema was adopted to it. And I don't understand why this is happening.

### Reproduction steps

-

Contributor guide

Open the contributing guide

Research direction

Compare the schema changes in resource.ts with the downloaded amplify_outputs.json across redeployments, including removing a model, changing a partition key, and adding a property. Start by reproducing the deployment and output download flow described in the issue. Done means the generated JSON matches the current schema and no longer retains removed models or fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.