Amplify-cli: Project appears to be in a bad state. How to purge all Amplify generated files to escape bad state.

Created on 19 Dec 2018  路  8Comments  路  Source: aws-amplify/amplify-cli

* Current behavior: *

amplify init
// edit backend/api/myapi/schema.graphql
amplify status --> API (Update), Auth (No Change), Storage (No Change)
amplify push --> Everything updates correctly, no errors.
amplify status --> API (Update), Auth (No Change), Storage (No Change)

expected behavior - everything the same as above except the final step should be:

amplify status --> API (No Change), Auth (No Change), Storage (No Change)

* What I've tried *

  1. Removing the following files
amplify/\#current-cloud-backend
amplify/backend/amplify-meta.json
src/aws-exports.js
aws-exports.js
awsconfiguration.json
  1. amplify init
  2. amplify status // (API status is: Update)
  3. amplify push // (succeeds)
  4. amplify status // (API status is: Update)

* Feature Request *
This appears to be a bug in Amplify, but I'm not sure how to reproduce it. I would like to reset Amplify to an initial state (without losing my API, Auth, or Storage configuration), which files do I need to remove to do so?

A command like amplify clean would be useful for when things go wrong.

investigating

Most helpful comment

@ajhool Could you try using amplify env pull --restore? This would basically restore your local backend with whatever is there in the cloud. (i.e in your current-cloud-backend folder).

All 8 comments

Thanks for reporting this, and providing suggestions.
Could you please provide the following information to help us to resolve it?

  • the cli version
  • the OS of your computer
  • the region of your aws backend project.
  • did you add Restful API or the GraphQL API?

cli version: 0.2.1-multienv.12
OS: Mac High Sierra 10.13.6
region: us-east-1
api: graphQL

Thanks we are investigating the issue.

I was not able to reproduce your issue with the latest version of the multienv version
0.2.1-multienv.14

Could you get the latest and see if the issue is still there?

I just executed amplify push and amplify status with multienv.14 and found the issue is still there.

Are there any files that you recommend I diff to see if there are real changes occurring in the appsync generation?

@ajhool Could you try using amplify env pull --restore? This would basically restore your local backend with whatever is there in the cloud. (i.e in your current-cloud-backend folder).

amplify env pull --restore has corrected the amplify status response (Operation = No Change for each service) and does not appear to have introduced any unexpected file changes, I will update if I find surprises. Thanks!

My ampify status is still showing an expired / deleted GraphQL API Key after doing the env pull --restore command - I can't do a push because it keeps putting the old API key into the #current-cloud-backend amplify-meta file. Any help?

Was this page helpful?
0 / 5 - 0 ratings