amplify api push does not update schema in cloud and reverts locally

Viewed 1902

I am using a serverless AWS-based architecture in my react app with AppSync, Cognito, and GraphQL. In the past I have been able to update my graphql schema locally and run amplify api push and it successfully pushes all of my changes to the cloud.

Recently I have been trying to update the cloud through amplify api push as I have in the pass, and the terminal says "All resources are update in the cloud". However, it reverts my schema to the schema version I had from last push. And needless to say, it was not updated in the cloud either.

No error messages are showing in the terminal.

The change I want to make is as follows:

Before-

type Topic @model {
  id: ID!
  postID: ID!
  name: String!
}

After-

type Topic @model {
  id: ID!
  name: String!
}

Any help will be much appreciated

3 Answers

SOLUTION

Make sure you are editing schema.graphql in the amplify/backend/api instead of current-cloud-backend/api directory

did you change parent directory/folder name? Once i changed my project's parent directory/folder name and amplify push stopped working. When reverted directory/folder name back to original fixed this.

In addition to making sure you are editing the correct schema.graphql, ensure that you are in the app's root directory when calling any amplify commands like amplify push or amplify pull. You might be editing a different schema.graphql from the one you are pushing.

Related