我跟着这个教程。在我将 aws-amplify 更新到 v3.3.26 之前它工作得很好。更新后,它停止将 IndexDB 与 DynamoDB 同步。我设置时没有任何错误Amplify.Logger.LOG_LEVEL = 'DEBUG'
。
在教程之后main.ts
我有:
import Amplify from "@aws-amplify/core";
import {DataStore} from "@aws-amplify/datastore";
import awsExports from "./aws-exports";
Amplify.configure(awsExports);
之后,我从 Amplify UI 中提取数据,生成了 GraphQl 模型和 src/aws-exports.js
const awsmobile = {
"aws_project_region": "REGION",
"aws_appsync_graphqlEndpoint": "https://xxxxxxxxxxx.appsync-api.REGION.amazonaws.com/graphql",
"aws_appsync_region": "REGION",
"aws_appsync_authenticationType": "API_KEY",
"aws_appsync_apiKey": "xxx-xxxxxxxxxxxxxxxxxx",
"aws_cognito_identity_pool_id": "REGION:xxxxx-xxxxxx-xxxxx-xxxxxxx-xxxxxxx",
"aws_cognito_region": "REGION",
"aws_user_pools_id": "REGION_xxxxxxxx",
"aws_user_pools_web_client_id": "xxxxxxxxxxxxxxxxx",
"oauth": {},
"aws_content_delivery_bucket": "BUCKET",
"aws_content_delivery_bucket_region": "us-east-2",
"aws_content_delivery_url": "http://BUCKET.s3-website.REGION.amazonaws.com"
};```
And I tried to update data like this:
等待 DataStore.save(User.copyOf(data, (item:MutableModel) => { item.phone = data.phone; }));```