Appsync GSI not producing existing DynamoDB record by Graphql using amplify
I've used Amplify to generate AppSync schema and GraphQL resolvers automatically. All of sudden, a major fetch stopped working. This is the query that I am running in the AppSync console:
query CreamByUuid {
creamByUUID(streamUUID: "6e1a5555-9999-6666-84c1-54e777777777", id: {}) {
items {
id
}
nextToken
}
milkBySlug(slug: "cherry-rare-solo-appearance") {
nextToken
items {
price
id
}
}
getCream(id: "77bababa-8888-3333-bb2b-857c470d5555") {
id
creamUUID
}
}
The first part is a GSI that fetches a stream by a field called the “creamUUID”. The problem is, the result returns an empty array:
{
"data": {
"creamByUUID": {
"items": [],
"nextToken": null
},
"milkBySlug": {
"nextToken": null,
"items": [
{
"price": 7,
"id": "17e50e71-ay7d-8382-1098-25c616444444"
}
]
},
"getCream": {
"id": "77bababa-8888-3333-bb2b-857c470d5555",
"creamUUID": "6e1a5555-9999-6666-84c1-54e777777777"
},
}
}
I’ve tested another GSI, milkBySlug, to make sure it’s not a broader GSI issue. As you see though, I am correctly getting an item back.
More troubling, when I fetch the Cream by its ID, I actually get the Cream record back (“getCream” returns the record with a creamUUID of “6e1a5555-9999-6666-84c1-54e777777777”)
So the Cream record exists in DynamoDB, and a direct query of it using an ID returns it. But a GSI creamByUUID with the creamUUID returns an empty array.
The resolver is autogenerated by amplify push, and I can share that if it is helpful. The queries I’m making are directly within the AWS console, so it can’t be a coding error on my part…
Can anyone help? I'm out of ideas about why the creamByUUID returns an empty array when it should return the Cream record with ID 77bababa-8888-3333-bb2b-857c470d5555
For anyone that experiences this issue, it's because I duplicated the GSIs on a new schema I created recently. I removed the GSIs on the new schema and things are working again!
The problem though is that amplify should not have let me add the new schema with duplicate GSIs. This is definitely a bug that should be looked at @aws
Relevant questions
How to achieve multiple Graphql endpoints
asked 4 months agoAppsync - DynamoDB from Amplify very slow response times
asked 2 months agoAppsync GSI not producing existing DynamoDB record by Graphql using amplify
Accepted Answerasked 4 months agoVisualizing amplify graphql definition
asked 3 months agoCan we use both GraphQL and REST API in the same project?
asked a year agoVTL resolver to authenticate multiple users from two different cognito pools
asked a month agoAppsync composite key (GSI in dynamodb) returns Null in query response
asked a month agoNeptune supports Neo4j GraphQL?
asked 3 days agoStoring/representing a hierarchical tree used for navigation within an Amplify web app and AppSync GraphQL API layer.
asked 22 days agoHow do I set up an AWS Amplify project to query an existing AWS AppSync API?
asked 2 months ago