@connection with multiple fields specified
** Which Category is your question related to? ** API
** What AWS Services are you utilizing? ** AWS AppSync, DynamoDB
** Provide additional details e.g. code snippets ** Hi, I'm trying to create a connection between two types as follows:
type Parent @model {
id: ID!
version: Int!
configs: [Config] @connection(keyName: "byParentAndVersion", fields: ["id", "version"])
}
type Config
@model
@key(name: "byParentAndVersion", fields: ["parentId", "parentVersion"], queryField: "configByParentAndVersion") {
id: ID!
parentId: ID!
parentVersion: Int!
...
}
When I query parent which includes the child configs, I receive a DynamoDB exception:
path: ["parent", "configs"] errorType: DynamoDB:AmazonDynamoDBException message: One or more parameter values were invalid: Condition parameter type does not match schema type (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ValidationException; Request ID: R1VS5AUFMQE8OQ45KIBLMQTEKBVV4KQNSO5AEMVJF66Q9ASUAAJG)
I'm not really sure what I'm doing wrong. I want to store config objects for my parent object, when I update the version of the parent I no longer want configs from the previous version returned.
I can't find any examples of this, but the documentation seems to suggest that this is possible, as my Config table has a secondary index where parentId is the Hash and version is the Sort key.
It's fine if this can't be done with a connection, I can always query the configs directly. But if it isn't possible, what's the point in allowing you to specify multiple fields on a connection?
@jonperryxlm I will transfer this issue to CLI repo, they can answer this question more appropriately
Hi @yuth I have already pinned another issue with the resolvers that are generated by the cli. ( #3468 ). Just wanted to know by when should this be rolling out. Also could you maybe give an example of a resolver that would work with composite keys? Or maybe a work around for now
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.