Reputation: 2859
I have an Amplify project where I've generated some GraphQL schema models. I previously deployed invalid syntax but the push otherwise completed successfully. However, I've corrected the error and tried to repush but I see the same previous syntax error that now no longer exists in the project.
Basically, if you run into modelgen error on a push, it bricks your application and you must start over because Amplify cannot get out of the failed state.
Things I've tried:
amplify push --allow-destructive-graphql-schema-updates
amplify pull
(fix syntax again)
amplify push
Manually add another change to 'break' cache
Push with force
amplify push --force
amplify update api --allow-destructive-graphql-schema-updates
(remove conflict resolution)
(succeeds at update)
amplify push (fails with same error)
amplify push --force --allow-destructive-graphql-schema-update
amplify pull --restore
The restore fails with the same bad syntax error
amplify init
amplify codegen models
amplify status -v (change is present)
amplify push --force -y
Same error is now observed
/amplify/#current-cloud-backend/api/{api_name}/schema.graphql
amplify rebuild api
Each time I run into the same syntax error as before.
How can I force push my changes locally which do not contain the syntax error? Basically, I'm wondering if there's an equivalent to
git push main --force
I'm guessing that Amplify is storing these hashes somewhere in S3 but I'm just baffled as to how the push doesn't break that cache or why it would be the same syntax error which no longer is in the project at all.
Extra possible context: https://github.com/aws-amplify/amplify-codegen/issues/220
Looks like bad state really requires the app to be deleted.
Amplify version (7.6.22)
Upvotes: 2
Views: 1154
Reputation: 31
Navigate to the s3 console AWS S3 Console
Identify the deployment bucket of your app Deployment Bucket
Download #current-cloud-backend.zip unzip the contents. Be sure to not accidentally zip as a nested folder: unzip "#current-cloud-backend.zip" -d "#current-cloud-backend" mv "#current-cloud-backend.zip" backup.zip
Correct the GraphQL schema and re-zip the folder. cd "#current-cloud-backend"; zip -r "../#current-cloud-backend.zip" *
Re-upload the newly zipped archive to your s3 deployment bucket.
Push from local machine with amplify push --force.
Referenced from https://github.com/aws-amplify/amplify-cli/issues/10118
Upvotes: 1
Reputation: 1
Got the latest cloud formation that worked with amplify pull, I did amplify function remove in one function I was having a similar problem, did a backup before doing the remove, then amplify push, then added the function again, amplify add function, and added my updated code back, then again amplify status and amplify push., is a bummer I know.
Upvotes: 0