DataStore - 订阅错误,连接失败:
DataStore - subscriptionError, Connection failed:
我正在研究 React Native、AWS、DynamoDB、Amplify 项目,并且我正在努力向数据库添加额外的 tables(模型)。
原来的模式非常简单。 (可能太简单了,效果不好)
type Capture @model {
id: ID!
captureID: String!
userID: String!
moodScore: String
emotion: String
lifeAspect: String
activity: String
companions: String
location: String
date: String
images: String
journalEntry: String
}
用户不断捕捉生活中的精彩瞬间。一切都存储为字符串(出于某种原因...)。
我正在尝试向应用添加更多 table。新的 table 并没有真正连接到当前的 table。唯一连接数据的是 UserID,当用户登录时,我们从“amplify/auth”获得。
我向 schema.graphql 添加了第二个模型:
type Capture @model {
id: ID!
captureID: String!
userID: String!
moodScore: String
emotion: String
lifeAspect: String
activity: String
companions: String
location: String
date: String
images: String
journalEntry: String
}
type DbConversion @model {
id: ID!
userID: String!
ConversionID: [String!]
}
我不想在 DynameDB 中连接 table。我想使用 DataStore 只在用户登录时加载当前用户的数据。
let uuID = '';
// Configure datastore to sync based on user identifier.
DataStore.configure({
syncExpressions: [
syncExpression(Capture, () => {
return (capture) => capture.userID('eq', uuID);
}),
syncExpression(DbConversion, () => {
return (dbconversion) => dbconversion.userID('eq', uuID);
}),
],
});
// Retrieve user ID and reset datastore sync with new data for uuID.
export async function changeSync() {
uuID = await getData('userID');
await DataStore.stop();
await DataStore.start();
}
一切正常,直到我尝试添加第二个 table。之后,我开始收到大量警告消息:
[WARN] 37:23.730 DataStore - subscriptionError, Connection failed: {"errors":[{"message":"Validation error of type FieldUndefined: Field '_version' in type 'Capture' is undefined @ 'onCreateCapture/_version'"},{"message":"Validation error of type FieldUndefined: Field '_lastChangedAt' in type 'Capture' is undefined @ 'onCreateCapture/_lastChangedAt'"},{"message":"Validation error of type FieldUndefined: Field '_deleted' in type 'Capture' is undefined @ 'onCreateCapture/_deleted'"}]}
at node_modules\react-native\Libraries\LogBox\LogBox.js:117:10 in registerWarning
at node_modules\react-native\Libraries\LogBox\LogBox.js:63:8 in warnImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:36:4 in console.warn
at node_modules\expo\build\environment\react-native-logs.fx.js:18:4 in warn
at node_modules\@aws-amplify\core\lib-esm\Logger\ConsoleLogger.js:138:12 in prototype._log
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:146334:21 in warn
at node_modules\@aws-amplify\datastore\lib-esm\sync\processors\subscription.js:357:87 in queryObservable.map.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\zen-observable\lib\Observable.js:329:17 in _this2.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\PubSub.js:180:37 in observable.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\Providers\AWSAppSyncRealTimeProvider.js:507:12 in prototype._handleIncomingSubscriptionMessage
at node_modules\event-target-shim\dist\event-target-shim.js:818:20 in EventTarget.prototype.dispatchEvent
at node_modules\react-native\Libraries\WebSocket\WebSocket.js:231:8 in _eventEmitter.addListener$argument_1
at node_modules\react-native\Libraries\vendor\emitter\EventEmitter.js:189:10 in emit
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:416:4 in __callFunction
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:109:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:108:4 in callFunctionReturnFlushedQueue
[WARN] 37:23.830 DataStore - subscriptionError, Connection failed: {"errors":[{"message":"Validation error of type FieldUndefined: Field '_version' in type 'Capture' is undefined @ 'onUpdateCapture/_version'"},{"message":"Validation error of type FieldUndefined: Field '_lastChangedAt' in type 'Capture' is undefined @ 'onUpdateCapture/_lastChangedAt'"},{"message":"Validation error of type FieldUndefined: Field '_deleted' in type 'Capture' is undefined @ 'onUpdateCapture/_deleted'"}]}
at node_modules\react-native\Libraries\LogBox\LogBox.js:117:10 in registerWarning
at node_modules\react-native\Libraries\LogBox\LogBox.js:63:8 in warnImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:36:4 in console.warn
at node_modules\expo\build\environment\react-native-logs.fx.js:18:4 in warn
at node_modules\@aws-amplify\core\lib-esm\Logger\ConsoleLogger.js:138:12 in prototype._log
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:146334:21 in warn
at node_modules\@aws-amplify\datastore\lib-esm\sync\processors\subscription.js:357:87 in queryObservable.map.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\zen-observable\lib\Observable.js:329:17 in _this2.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\PubSub.js:180:37 in observable.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\Providers\AWSAppSyncRealTimeProvider.js:507:12 in prototype._handleIncomingSubscriptionMessage
at node_modules\event-target-shim\dist\event-target-shim.js:818:20 in EventTarget.prototype.dispatchEvent
at node_modules\react-native\Libraries\WebSocket\WebSocket.js:231:8 in _eventEmitter.addListener$argument_1
at node_modules\react-native\Libraries\vendor\emitter\EventEmitter.js:189:10 in emit
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:416:4 in __callFunction
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:109:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:108:4 in callFunctionReturnFlushedQueue
[WARN] 37:23.896 DataStore - subscriptionError, Connection failed: {"errors":[{"message":"Validation error of type FieldUndefined: Field '_version' in type 'DbConversion' is undefined @ 'onCreateDbConversion/_version'"},{"message":"Validation error of type FieldUndefined: Field '_lastChangedAt' in type 'DbConversion' is undefined @ 'onCreateDbConversion/_lastChangedAt'"},{"message":"Validation error of type FieldUndefined: Field '_deleted' in type 'DbConversion' is undefined @ 'onCreateDbConversion/_deleted'"}]}
at node_modules\react-native\Libraries\LogBox\LogBox.js:117:10 in registerWarning
at node_modules\react-native\Libraries\LogBox\LogBox.js:63:8 in warnImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:36:4 in console.warn
at node_modules\expo\build\environment\react-native-logs.fx.js:18:4 in warn
at node_modules\@aws-amplify\core\lib-esm\Logger\ConsoleLogger.js:138:12 in prototype._log
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:146334:21 in warn
at node_modules\@aws-amplify\datastore\lib-esm\sync\processors\subscription.js:357:87 in queryObservable.map.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\zen-observable\lib\Observable.js:329:17 in _this2.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\PubSub.js:180:37 in observable.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\Providers\AWSAppSyncRealTimeProvider.js:507:12 in prototype._handleIncomingSubscriptionMessage
at node_modules\event-target-shim\dist\event-target-shim.js:818:20 in EventTarget.prototype.dispatchEvent
at node_modules\react-native\Libraries\WebSocket\WebSocket.js:231:8 in _eventEmitter.addListener$argument_1
at node_modules\react-native\Libraries\vendor\emitter\EventEmitter.js:189:10 in emit
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:416:4 in __callFunction
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:109:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:108:4 in callFunctionReturnFlushedQueue
[WARN] 37:23.967 DataStore - subscriptionError, Connection failed: {"errors":[{"message":"Validation error of type FieldUndefined: Field '_version' in type 'Capture' is undefined @ 'onDeleteCapture/_version'"},{"message":"Validation error of type FieldUndefined: Field '_lastChangedAt' in type 'Capture' is undefined @ 'onDeleteCapture/_lastChangedAt'"},{"message":"Validation error of type FieldUndefined: Field '_deleted' in type 'Capture' is undefined @ 'onDeleteCapture/_deleted'"}]}
at node_modules\react-native\Libraries\LogBox\LogBox.js:117:10 in registerWarning
at node_modules\react-native\Libraries\LogBox\LogBox.js:63:8 in warnImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:36:4 in console.warn
at node_modules\expo\build\environment\react-native-logs.fx.js:18:4 in warn
at node_modules\@aws-amplify\core\lib-esm\Logger\ConsoleLogger.js:138:12 in prototype._log
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:146334:21 in warn
at node_modules\@aws-amplify\datastore\lib-esm\sync\processors\subscription.js:357:87 in queryObservable.map.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\zen-observable\lib\Observable.js:329:17 in _this2.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\PubSub.js:180:37 in observable.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\Providers\AWSAppSyncRealTimeProvider.js:507:12 in prototype._handleIncomingSubscriptionMessage
at node_modules\event-target-shim\dist\event-target-shim.js:818:20 in EventTarget.prototype.dispatchEvent
at node_modules\react-native\Libraries\WebSocket\WebSocket.js:231:8 in _eventEmitter.addListener$argument_1
at node_modules\react-native\Libraries\vendor\emitter\EventEmitter.js:189:10 in emit
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:416:4 in __callFunction
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:109:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:108:4 in callFunctionReturnFlushedQueue
[WARN] 37:24.77 DataStore - subscriptionError, Connection failed: {"errors":[{"message":"Validation error of type FieldUndefined: Field '_version' in type 'DbConversion' is undefined @ 'onDeleteDbConversion/_version'"},{"message":"Validation error of type FieldUndefined: Field '_lastChangedAt' in type 'DbConversion' is undefined @ 'onDeleteDbConversion/_lastChangedAt'"},{"message":"Validation error of type FieldUndefined: Field '_deleted' in type 'DbConversion' is undefined @ 'onDeleteDbConversion/_deleted'"}]}
at node_modules\react-native\Libraries\LogBox\LogBox.js:117:10 in registerWarning
at node_modules\react-native\Libraries\LogBox\LogBox.js:63:8 in warnImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:36:4 in console.warn
at node_modules\expo\build\environment\react-native-logs.fx.js:18:4 in warn
at node_modules\@aws-amplify\core\lib-esm\Logger\ConsoleLogger.js:138:12 in prototype._log
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:146334:21 in warn
at node_modules\@aws-amplify\datastore\lib-esm\sync\processors\subscription.js:357:87 in queryObservable.map.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\zen-observable\lib\Observable.js:329:17 in _this2.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\PubSub.js:180:37 in observable.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\Providers\AWSAppSyncRealTimeProvider.js:507:12 in prototype._handleIncomingSubscriptionMessage
at node_modules\event-target-shim\dist\event-target-shim.js:818:20 in EventTarget.prototype.dispatchEvent
at node_modules\react-native\Libraries\WebSocket\WebSocket.js:231:8 in _eventEmitter.addListener$argument_1
at node_modules\react-native\Libraries\vendor\emitter\EventEmitter.js:189:10 in emit
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:416:4 in __callFunction
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:109:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:108:4 in callFunctionReturnFlushedQueue
[WARN] 37:24.155 DataStore - subscriptionError, Connection failed: {"errors":[{"message":"Validation error of type FieldUndefined: Field '_version' in type 'DbConversion' is undefined @ 'onUpdateDbConversion/_version'"},{"message":"Validation error of type FieldUndefined: Field '_lastChangedAt' in type 'DbConversion' is undefined @ 'onUpdateDbConversion/_lastChangedAt'"},{"message":"Validation error of type FieldUndefined: Field '_deleted' in type 'DbConversion' is undefined @ 'onUpdateDbConversion/_deleted'"}]}
at node_modules\react-native\Libraries\LogBox\LogBox.js:117:10 in registerWarning
at node_modules\react-native\Libraries\LogBox\LogBox.js:63:8 in warnImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:36:4 in console.warn
at node_modules\expo\build\environment\react-native-logs.fx.js:18:4 in warn
at node_modules\@aws-amplify\core\lib-esm\Logger\ConsoleLogger.js:138:12 in prototype._log
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:146334:21 in warn
at node_modules\@aws-amplify\datastore\lib-esm\sync\processors\subscription.js:357:87 in queryObservable.map.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\zen-observable\lib\Observable.js:329:17 in _this2.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\PubSub.js:180:37 in observable.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\Providers\AWSAppSyncRealTimeProvider.js:507:12 in prototype._handleIncomingSubscriptionMessage
at node_modules\event-target-shim\dist\event-target-shim.js:818:20 in EventTarget.prototype.dispatchEvent
at node_modules\react-native\Libraries\WebSocket\WebSocket.js:231:8 in _eventEmitter.addListener$argument_1
at node_modules\react-native\Libraries\vendor\emitter\EventEmitter.js:189:10 in emit
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:416:4 in __callFunction
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:109:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:108:4 in callFunctionReturnFlushedQueue
Setting a timer for a long period of time, i.e. multiple minutes, is a performance and correctness issue on Android as it keeps the timer module awake, and timers can only be called when the app is in the foreground. See https://github.com/facebook/react-native/issues/12981 for more info.
(Saw setTimeout with duration 102478.61620927726ms)
at node_modules\react-native\Libraries\LogBox\LogBox.js:117:10 in registerWarning
at node_modules\react-native\Libraries\LogBox\LogBox.js:63:8 in warnImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:36:4 in console.warn
at node_modules\expo\build\environment\react-native-logs.fx.js:18:4 in warn
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:226:6 in setTimeout
at node_modules\@aws-amplify\core\lib-esm\Util\Retry.js:116:45 in __generator$argument_1
at node_modules\react-native\node_modules\promise\setimmediate\core.js:45:6 in tryCallTwo
at node_modules\react-native\node_modules\promise\setimmediate\core.js:200:22 in doResolve
at node_modules\react-native\node_modules\promise\setimmediate\core.js:66:11 in Promise
at node_modules\@aws-amplify\core\lib-esm\Util\Retry.js:115:40 in __generator$argument_1
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:147977:26 in step
at node_modules\tslib\tslib.js:122:34 in <anonymous>
at node_modules\tslib\tslib.js:113:43 in rejected
at node_modules\react-native\node_modules\promise\setimmediate\core.js:37:13 in tryCallOne
at node_modules\react-native\node_modules\promise\setimmediate\core.js:123:24 in setImmediate$argument_0
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:130:14 in _callTimer
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:181:14 in _callImmediatesPass
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:441:30 in callImmediates
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:387:6 in __callImmediates
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:135:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:134:4 in flushedQueue
我在 GitHub 论坛上找到了解决方案:
https://github.com/aws-amplify/amplify-js/issues/4535#issuecomment-589594827
这使我的 API 可以同步,并且警告消失了:
You could also add this you the transform.conf.json directly:
{ "Version": 5, "ResolverConfig": { "project": { "ConflictHandler": "AUTOMERGE", "ConflictDetection": "VERSION" } } }
下一个问题是,这个之前是怎么做到的? :D
我正在研究 React Native、AWS、DynamoDB、Amplify 项目,并且我正在努力向数据库添加额外的 tables(模型)。
原来的模式非常简单。 (可能太简单了,效果不好)
type Capture @model {
id: ID!
captureID: String!
userID: String!
moodScore: String
emotion: String
lifeAspect: String
activity: String
companions: String
location: String
date: String
images: String
journalEntry: String
}
用户不断捕捉生活中的精彩瞬间。一切都存储为字符串(出于某种原因...)。
我正在尝试向应用添加更多 table。新的 table 并没有真正连接到当前的 table。唯一连接数据的是 UserID,当用户登录时,我们从“amplify/auth”获得。
我向 schema.graphql 添加了第二个模型:
type Capture @model {
id: ID!
captureID: String!
userID: String!
moodScore: String
emotion: String
lifeAspect: String
activity: String
companions: String
location: String
date: String
images: String
journalEntry: String
}
type DbConversion @model {
id: ID!
userID: String!
ConversionID: [String!]
}
我不想在 DynameDB 中连接 table。我想使用 DataStore 只在用户登录时加载当前用户的数据。
let uuID = '';
// Configure datastore to sync based on user identifier.
DataStore.configure({
syncExpressions: [
syncExpression(Capture, () => {
return (capture) => capture.userID('eq', uuID);
}),
syncExpression(DbConversion, () => {
return (dbconversion) => dbconversion.userID('eq', uuID);
}),
],
});
// Retrieve user ID and reset datastore sync with new data for uuID.
export async function changeSync() {
uuID = await getData('userID');
await DataStore.stop();
await DataStore.start();
}
一切正常,直到我尝试添加第二个 table。之后,我开始收到大量警告消息:
[WARN] 37:23.730 DataStore - subscriptionError, Connection failed: {"errors":[{"message":"Validation error of type FieldUndefined: Field '_version' in type 'Capture' is undefined @ 'onCreateCapture/_version'"},{"message":"Validation error of type FieldUndefined: Field '_lastChangedAt' in type 'Capture' is undefined @ 'onCreateCapture/_lastChangedAt'"},{"message":"Validation error of type FieldUndefined: Field '_deleted' in type 'Capture' is undefined @ 'onCreateCapture/_deleted'"}]}
at node_modules\react-native\Libraries\LogBox\LogBox.js:117:10 in registerWarning
at node_modules\react-native\Libraries\LogBox\LogBox.js:63:8 in warnImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:36:4 in console.warn
at node_modules\expo\build\environment\react-native-logs.fx.js:18:4 in warn
at node_modules\@aws-amplify\core\lib-esm\Logger\ConsoleLogger.js:138:12 in prototype._log
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:146334:21 in warn
at node_modules\@aws-amplify\datastore\lib-esm\sync\processors\subscription.js:357:87 in queryObservable.map.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\zen-observable\lib\Observable.js:329:17 in _this2.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\PubSub.js:180:37 in observable.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\Providers\AWSAppSyncRealTimeProvider.js:507:12 in prototype._handleIncomingSubscriptionMessage
at node_modules\event-target-shim\dist\event-target-shim.js:818:20 in EventTarget.prototype.dispatchEvent
at node_modules\react-native\Libraries\WebSocket\WebSocket.js:231:8 in _eventEmitter.addListener$argument_1
at node_modules\react-native\Libraries\vendor\emitter\EventEmitter.js:189:10 in emit
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:416:4 in __callFunction
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:109:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:108:4 in callFunctionReturnFlushedQueue
[WARN] 37:23.830 DataStore - subscriptionError, Connection failed: {"errors":[{"message":"Validation error of type FieldUndefined: Field '_version' in type 'Capture' is undefined @ 'onUpdateCapture/_version'"},{"message":"Validation error of type FieldUndefined: Field '_lastChangedAt' in type 'Capture' is undefined @ 'onUpdateCapture/_lastChangedAt'"},{"message":"Validation error of type FieldUndefined: Field '_deleted' in type 'Capture' is undefined @ 'onUpdateCapture/_deleted'"}]}
at node_modules\react-native\Libraries\LogBox\LogBox.js:117:10 in registerWarning
at node_modules\react-native\Libraries\LogBox\LogBox.js:63:8 in warnImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:36:4 in console.warn
at node_modules\expo\build\environment\react-native-logs.fx.js:18:4 in warn
at node_modules\@aws-amplify\core\lib-esm\Logger\ConsoleLogger.js:138:12 in prototype._log
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:146334:21 in warn
at node_modules\@aws-amplify\datastore\lib-esm\sync\processors\subscription.js:357:87 in queryObservable.map.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\zen-observable\lib\Observable.js:329:17 in _this2.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\PubSub.js:180:37 in observable.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\Providers\AWSAppSyncRealTimeProvider.js:507:12 in prototype._handleIncomingSubscriptionMessage
at node_modules\event-target-shim\dist\event-target-shim.js:818:20 in EventTarget.prototype.dispatchEvent
at node_modules\react-native\Libraries\WebSocket\WebSocket.js:231:8 in _eventEmitter.addListener$argument_1
at node_modules\react-native\Libraries\vendor\emitter\EventEmitter.js:189:10 in emit
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:416:4 in __callFunction
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:109:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:108:4 in callFunctionReturnFlushedQueue
[WARN] 37:23.896 DataStore - subscriptionError, Connection failed: {"errors":[{"message":"Validation error of type FieldUndefined: Field '_version' in type 'DbConversion' is undefined @ 'onCreateDbConversion/_version'"},{"message":"Validation error of type FieldUndefined: Field '_lastChangedAt' in type 'DbConversion' is undefined @ 'onCreateDbConversion/_lastChangedAt'"},{"message":"Validation error of type FieldUndefined: Field '_deleted' in type 'DbConversion' is undefined @ 'onCreateDbConversion/_deleted'"}]}
at node_modules\react-native\Libraries\LogBox\LogBox.js:117:10 in registerWarning
at node_modules\react-native\Libraries\LogBox\LogBox.js:63:8 in warnImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:36:4 in console.warn
at node_modules\expo\build\environment\react-native-logs.fx.js:18:4 in warn
at node_modules\@aws-amplify\core\lib-esm\Logger\ConsoleLogger.js:138:12 in prototype._log
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:146334:21 in warn
at node_modules\@aws-amplify\datastore\lib-esm\sync\processors\subscription.js:357:87 in queryObservable.map.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\zen-observable\lib\Observable.js:329:17 in _this2.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\PubSub.js:180:37 in observable.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\Providers\AWSAppSyncRealTimeProvider.js:507:12 in prototype._handleIncomingSubscriptionMessage
at node_modules\event-target-shim\dist\event-target-shim.js:818:20 in EventTarget.prototype.dispatchEvent
at node_modules\react-native\Libraries\WebSocket\WebSocket.js:231:8 in _eventEmitter.addListener$argument_1
at node_modules\react-native\Libraries\vendor\emitter\EventEmitter.js:189:10 in emit
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:416:4 in __callFunction
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:109:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:108:4 in callFunctionReturnFlushedQueue
[WARN] 37:23.967 DataStore - subscriptionError, Connection failed: {"errors":[{"message":"Validation error of type FieldUndefined: Field '_version' in type 'Capture' is undefined @ 'onDeleteCapture/_version'"},{"message":"Validation error of type FieldUndefined: Field '_lastChangedAt' in type 'Capture' is undefined @ 'onDeleteCapture/_lastChangedAt'"},{"message":"Validation error of type FieldUndefined: Field '_deleted' in type 'Capture' is undefined @ 'onDeleteCapture/_deleted'"}]}
at node_modules\react-native\Libraries\LogBox\LogBox.js:117:10 in registerWarning
at node_modules\react-native\Libraries\LogBox\LogBox.js:63:8 in warnImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:36:4 in console.warn
at node_modules\expo\build\environment\react-native-logs.fx.js:18:4 in warn
at node_modules\@aws-amplify\core\lib-esm\Logger\ConsoleLogger.js:138:12 in prototype._log
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:146334:21 in warn
at node_modules\@aws-amplify\datastore\lib-esm\sync\processors\subscription.js:357:87 in queryObservable.map.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\zen-observable\lib\Observable.js:329:17 in _this2.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\PubSub.js:180:37 in observable.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\Providers\AWSAppSyncRealTimeProvider.js:507:12 in prototype._handleIncomingSubscriptionMessage
at node_modules\event-target-shim\dist\event-target-shim.js:818:20 in EventTarget.prototype.dispatchEvent
at node_modules\react-native\Libraries\WebSocket\WebSocket.js:231:8 in _eventEmitter.addListener$argument_1
at node_modules\react-native\Libraries\vendor\emitter\EventEmitter.js:189:10 in emit
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:416:4 in __callFunction
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:109:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:108:4 in callFunctionReturnFlushedQueue
[WARN] 37:24.77 DataStore - subscriptionError, Connection failed: {"errors":[{"message":"Validation error of type FieldUndefined: Field '_version' in type 'DbConversion' is undefined @ 'onDeleteDbConversion/_version'"},{"message":"Validation error of type FieldUndefined: Field '_lastChangedAt' in type 'DbConversion' is undefined @ 'onDeleteDbConversion/_lastChangedAt'"},{"message":"Validation error of type FieldUndefined: Field '_deleted' in type 'DbConversion' is undefined @ 'onDeleteDbConversion/_deleted'"}]}
at node_modules\react-native\Libraries\LogBox\LogBox.js:117:10 in registerWarning
at node_modules\react-native\Libraries\LogBox\LogBox.js:63:8 in warnImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:36:4 in console.warn
at node_modules\expo\build\environment\react-native-logs.fx.js:18:4 in warn
at node_modules\@aws-amplify\core\lib-esm\Logger\ConsoleLogger.js:138:12 in prototype._log
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:146334:21 in warn
at node_modules\@aws-amplify\datastore\lib-esm\sync\processors\subscription.js:357:87 in queryObservable.map.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\zen-observable\lib\Observable.js:329:17 in _this2.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\PubSub.js:180:37 in observable.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\Providers\AWSAppSyncRealTimeProvider.js:507:12 in prototype._handleIncomingSubscriptionMessage
at node_modules\event-target-shim\dist\event-target-shim.js:818:20 in EventTarget.prototype.dispatchEvent
at node_modules\react-native\Libraries\WebSocket\WebSocket.js:231:8 in _eventEmitter.addListener$argument_1
at node_modules\react-native\Libraries\vendor\emitter\EventEmitter.js:189:10 in emit
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:416:4 in __callFunction
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:109:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:108:4 in callFunctionReturnFlushedQueue
[WARN] 37:24.155 DataStore - subscriptionError, Connection failed: {"errors":[{"message":"Validation error of type FieldUndefined: Field '_version' in type 'DbConversion' is undefined @ 'onUpdateDbConversion/_version'"},{"message":"Validation error of type FieldUndefined: Field '_lastChangedAt' in type 'DbConversion' is undefined @ 'onUpdateDbConversion/_lastChangedAt'"},{"message":"Validation error of type FieldUndefined: Field '_deleted' in type 'DbConversion' is undefined @ 'onUpdateDbConversion/_deleted'"}]}
at node_modules\react-native\Libraries\LogBox\LogBox.js:117:10 in registerWarning
at node_modules\react-native\Libraries\LogBox\LogBox.js:63:8 in warnImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:36:4 in console.warn
at node_modules\expo\build\environment\react-native-logs.fx.js:18:4 in warn
at node_modules\@aws-amplify\core\lib-esm\Logger\ConsoleLogger.js:138:12 in prototype._log
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:146334:21 in warn
at node_modules\@aws-amplify\datastore\lib-esm\sync\processors\subscription.js:357:87 in queryObservable.map.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\zen-observable\lib\Observable.js:329:17 in _this2.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\PubSub.js:180:37 in observable.subscribe$argument_0.error
at node_modules\zen-observable\lib\Observable.js:139:8 in notifySubscription
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:150453:22 in onNotify
at node_modules\zen-observable\lib\Observable.js:239:11 in error
at node_modules\@aws-amplify\pubsub\lib-esm\Providers\AWSAppSyncRealTimeProvider.js:507:12 in prototype._handleIncomingSubscriptionMessage
at node_modules\event-target-shim\dist\event-target-shim.js:818:20 in EventTarget.prototype.dispatchEvent
at node_modules\react-native\Libraries\WebSocket\WebSocket.js:231:8 in _eventEmitter.addListener$argument_1
at node_modules\react-native\Libraries\vendor\emitter\EventEmitter.js:189:10 in emit
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:416:4 in __callFunction
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:109:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:108:4 in callFunctionReturnFlushedQueue
Setting a timer for a long period of time, i.e. multiple minutes, is a performance and correctness issue on Android as it keeps the timer module awake, and timers can only be called when the app is in the foreground. See https://github.com/facebook/react-native/issues/12981 for more info.
(Saw setTimeout with duration 102478.61620927726ms)
at node_modules\react-native\Libraries\LogBox\LogBox.js:117:10 in registerWarning
at node_modules\react-native\Libraries\LogBox\LogBox.js:63:8 in warnImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:36:4 in console.warn
at node_modules\expo\build\environment\react-native-logs.fx.js:18:4 in warn
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:226:6 in setTimeout
at node_modules\@aws-amplify\core\lib-esm\Util\Retry.js:116:45 in __generator$argument_1
at node_modules\react-native\node_modules\promise\setimmediate\core.js:45:6 in tryCallTwo
at node_modules\react-native\node_modules\promise\setimmediate\core.js:200:22 in doResolve
at node_modules\react-native\node_modules\promise\setimmediate\core.js:66:11 in Promise
at node_modules\@aws-amplify\core\lib-esm\Util\Retry.js:115:40 in __generator$argument_1
at http://192.168.0.105:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:147977:26 in step
at node_modules\tslib\tslib.js:122:34 in <anonymous>
at node_modules\tslib\tslib.js:113:43 in rejected
at node_modules\react-native\node_modules\promise\setimmediate\core.js:37:13 in tryCallOne
at node_modules\react-native\node_modules\promise\setimmediate\core.js:123:24 in setImmediate$argument_0
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:130:14 in _callTimer
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:181:14 in _callImmediatesPass
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:441:30 in callImmediates
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:387:6 in __callImmediates
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:135:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:134:4 in flushedQueue
我在 GitHub 论坛上找到了解决方案: https://github.com/aws-amplify/amplify-js/issues/4535#issuecomment-589594827
这使我的 API 可以同步,并且警告消失了:
You could also add this you the transform.conf.json directly:
{ "Version": 5, "ResolverConfig": { "project": { "ConflictHandler": "AUTOMERGE", "ConflictDetection": "VERSION" } } }
下一个问题是,这个之前是怎么做到的? :D