amplify api 推送不更新云中的架构并在本地还原

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

我在带有 AppSync、Cognito 和 GraphQL 的 React 应用程序中使用基于 AWS 的无服务器架构。在过去,我已经能够在本地更新我的 graphql 架构,并且 运行 amplify api push 并且它成功地将我的所有更改推送到云端。

最近我一直在尝试通过amplify api push更新云,就像我在通行证中一样,终端显示"All resources are update in the cloud"。但是,它将我的模式恢复为上次推送时的模式版本。不用说,它也没有在云端更新。

终端中没有显示任何错误消息。

我想做的改动如下:

之前-

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

之后-

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

任何帮助将不胜感激

解决方案

确保您在 amplify/backend/api 而不是 current-cloud-backend/api 目录中编辑 schema.graphql

您是否更改了 parent directory/folder 名称? 一旦我更改了项目的 parent directory/folder 名称并放大推送停止工作。 当恢复 directory/folder 名称回到原来的固定这个。

除了确保您正在编辑正确的 schema.graphql 之外,请确保您在调用任何 amplify 命令(例如 amplify pushamplify pull. 时位于应用程序的根目录中] 您可能编辑的 schema.graphql 与您正在推送的不同。