* Which Category is your question related to? *
GraphQL Schema
* What AWS Services are you utilizing? *
API, AppSync
* Provide additional details e.g. code snippets *
The below produces this expected error on amplify push:
Expected scalar and got User
type Membership @model @key(fields: ["user"], name: "ByUser", queryField: "membershipsByUser") {
id: ID!
channel: Channel @connection(name: "channelMemberships")
user: User @connection(name: "userMemberships")
}
Can we create a gsi on a connection field? Ultimately it's represented by the id.
I realized I'm approaching this the wrong way. Too much friction. Please ignore. If anyone comes across a similar requirement, hit me up.
I realized I'm approaching this the wrong way. Too much friction. Please ignore. If anyone comes across a similar requirement, hit me up.
Here :) so how did you fix this? i need to use @key, but than i need a connection for a field inside
I realized I'm approaching this the wrong way. Too much friction. Please ignore. If anyone comes across a similar requirement, hit me up.
I'm also interested to see how you resolved this. Thanks!
oh wow sorry guys just saw this @davidbiller @amirmishani
If I remember correctly I wanted to be able to query the table with the non key field which was a @connection field. No point to create a gsi around, since @connection I believe creates a gsi under the hood. So You really just need to go to the table being referenced. In my case for example, table User has memberships and if I say user.memberships, that will give me all the user memberships I need. That's technically a query using a gsi in the membership table.
So long story short, don't use a @key on @connection.