-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sync up issue for iOS with nullable field and enabled secondary index #306
Comments
Hi @wer32 thanks for your detailed explanation and the issue. Could you clarify : If you send null it won't work and requires a restart of an application. From what I read it sounds like the item is not being saved, but you're not getting any exception at all. Is that the case or is the application freezing and becoming unresponsive? Why do you have to restart the application? |
Hi @fjnoyp |
This is a bug report I just filed that includes a couple of bugs I found and the workarounds to each |
Hey @wer32 I'm sorry for not keeping in touch. Following your description, I created a minimal example to reproduce the issue. Schema that I was testing with: type TestModel @model @key(name: "byParentId", field: ["parentId"]) {
id: ID!
content: String!
parentId: ID
} In Dart final testModel = TestModel(content: "Testing string");
await Amplify.DataStore.save(testModel);
print("saved") Interestingly, there is no error happened, and Dart printed "saved" in the console. Then I inspected local SQLite DB, the model is saved, however, model is not synced to cloud. Tried to save model again, and inspected network traffic {
"query": "mutation CreateTestModel($input: CreateTestModelInput!) {\n createTestModel(input: $input) {\n id\n content\n parentId\n __typename\n _version\n _deleted\n _lastChangedAt\n }\n}",
"variables": {
"input": {
"content": "Test content",
"id": "902cd218-799e-4b66-9d24-20a0d7406d22",
"parentId": null
}
}
} Response {
"data": {
"createTestModel": null
},
"errors": [{
"path": ["createTestModel"],
"data": null,
"errorType": "DynamoDB:DynamoDbException",
"errorInfo": null,
"locations": [{
"line": 2,
"column": 3,
"sourceName": null
}],
"message": "One or more parameter values were invalid: Type mismatch for Index Key parentId Expected: S Actual: NULL IndexName: parent-id-index (Service: DynamoDb, Status Code: 400, Request ID: B3AHK1Q1ESMHO7635VKKGQHP9JVV4KQNSO5AEMVJF66Q9ASUAAJG, Extended Request ID: null)"
}]
} There is an error returned from DynamoDB
It looks like that DynamoDB rejected the At this point we have had two issues:
the `OutboxMutationFailedEvent`
In the GraphQL request it explicitly sent Therefore, the 3rd issue is that when a field is used as partition key, when generating GraphQL document for DataStore cloud syncing, and if the value of this field is I'll create issues in each library repo for tracking the fix. |
This is no longer an issue with GraphQL Transformer v2 type SecondIndexModel @model {
id: ID! @primaryKey
parentID: ID @index(name: "parent-id-index")
} When |
The testing env might have been setup wrongly. This issue is still reproducible with transformer v2 |
Amplify CLI opened an issue for looking for a solution aws-amplify/amplify-cli#9915 |
The underlying issue has been fixed on Amplify CLI side. Please ensure upgrade to Amplify CLI version >=8.0.2, and re-deploy schema (regenerate resolvers). |
Describe the bug
DataStore sync up doesn't work with iOS if the field is null in case of a secondary index is created.
in case if you send a Task with parentID field with some values the sync up works. If you send null it won't work and requires a restart of an application. I was able to reproduce the issue on iOS devices only.
To Reproduce
Expected behavior
Platform
Amplify Flutter currently supports iOS and Android. This issue is reproducible in (check all that apply):
[] Android
[v] iOS
Smartphone (please complete the following information):
test_model_amplify.zip
The text was updated successfully, but these errors were encountered: