-
Notifications
You must be signed in to change notification settings - Fork 77
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
DataStore.save() fails when a field used as a partition key is left empty #1360
Comments
Hello @justkj7 - can you confirm you have conflict resolution enabled? You can view the conflict resolution strategy in |
Hi @Jordan-Nelson Yes. Here is snippet for conflict resolution in cli-inputs.json.
|
Hello @justkj7 sorry for the delayed response. I was trying to repro this issue you were experience. Could you let me know:
|
Hi @justkj7 I see the issue now. Looking at your schema for type Room @model @auth(rules: [{allow: public}]) {
id: ID! @index(name: "roomIdOnCreatedAt", sortKeyFields: ["createdAt"], queryField: "roomIdOnCreatedAt")
name: String!
Messages: [Message] @hasMany(indexName: "byRoom", fields: ["id"])
createdAt: AWSDateTime
} You are creating a Secondary Index on the model id field (this field is the partition key in DynamoDB), where you also specified When you invoke the Room newRoom = Room(
name: _tfNameController.text,
);
await Amplify.DataStore.save(newRoom); You haven't provided a value for {
"variables": {
"input": {
"name": "a room",
"id": "0417e26f-c95c-4f38-8c4d-9e9b00e0ae5b",
"createdAt": null
}
},
"query": "mutation CreateRoom($input: CreateRoomInput!) {\n createRoom(input: $input) {\n id\n createdAt\n name\n updatedAt\n __typename\n _version\n _deleted\n _lastChangedAt\n }\n}"
} As {
"data": {
"createRoom": null
},
"errors": [{
"path": ["createRoom"],
"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 createdAt Expected: S Actual: NULL IndexName: roomIdOnCreatedAt (Service: DynamoDb, Status Code: 400, Request ID: 1FPMGDEJ1D64H5VD267OABTU6RVV4KQNSO5AEMVJF66Q9ASUAAJG)"
}]
} So the data failed to sync to cloud. As your In the meantime, please try to provide a valid value for |
Hi @HuiSF Thanks a lot for answering my queries. The reason not to specify |
Hi @justkj7 sorry for the delayed response. This issue is very similar to aws-amplify/amplify-flutter#306 which probably requires a fix in the transformer. I've reached out to amplify-category-api maintainers for taking a look. |
I am facing the same issue here! |
Duplicate of aws-amplify/amplify-flutter#5050 |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Description
I deployed my stack in remote server already using
amplify init && amplify push
However, when DataStore.save() is invoked, it seems local db is updated but db in remote server is not updated correspondingly.
Here is amplify status using the command.
Categories
Steps to Reproduce
Screenshots
No response
Platforms
Android Device/Emulator API Level
No response
Environment
Dependencies
Device
iPhone SE - 3rd generation
OS
iOS 15.5
CLI Version
8.3.1
Additional Context
No response
The text was updated successfully, but these errors were encountered: