amplify-studio icon indicating copy to clipboard operation
amplify-studio copied to clipboard

model with index and sort causes sync issue on data manager

Open ykethan opened this issue 1 year ago • 1 comments

Before opening, please confirm:

  • [X] I have searched for duplicate or closed issues.
  • [X] I have read the guide for submitting bug reports.
  • [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • [X] I have removed any sensitive information from my code snippets and submission.

App Id

d3agmbof1zzckq

Region

us-east-1

Environment name

dev

Figma File Version (if applicable)

No response

Amplify CLI Version

No response

If applicable, what version of Node.js are you using?

No response

What operating system are you using?

No response

Browser type?

No response

Describe the bug

using the following model

type Message @model @auth(rules: [{allow: public}]) {
  id: ID!
  text: String
  type: String @index(name: "messagesByDate", queryField: "messagesByDate", sortKeyFields: ["createdAt"])
  createdAt: String
}

and creating a record with the following

image

results in the following and does not change state image

error on networking tab

{"data":{"createMessage":null},"errors":[{"path":["createMessage"],"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: messagesByDate (Service: DynamoDb, Status Code: 400, Request ID: GIG0V003AI19AR231KSTNQ1GIBVV4KQNSO5AEMVJF66Q9ASUAAJG)"}]}

Expected behavior

display error is mutation fails and work as expected

Reproduction steps

  1. use the data model provided then push using amplify cli
  2. open data manager
  3. create a record

Project Identifier

No response

Additional information

No response

ykethan avatar May 19 '23 18:05 ykethan

Is there any update on that ?

fistofzen avatar Aug 13 '23 13:08 fistofzen