By using AWS re:Post, you agree to the Terms of Use
Questions in Serverless
Sort by most recent

Browse through the questions and answers listed below or filter and sort to narrow down your results.

Querying an index with Android Amplify GraphQL

I'm trying to perform a GraphQL query against an index using Amplify and the Android SDK. I have a query that works when tested via the AppSync dashboard. It returns the one record I can see in DynamoDB that it should match against. **membersEmailByInviteCode** is an index defined in the Schema. ``` query get { membersEmailByInviteCode(email: "" inviteCode: { eq: "CustomCode"} ) { items { id } } } ``` When I enable CloudWatch Logs and run the query from within the code I can see the following being sent, but I get an empty object back, which I'm guessing means that it hasn't been able to find anything. ``` query get($email: String!, $code: String!) { membersEmailByInviteCode(email: $email inviteCode: { eq: $code} ) { items { id } } }, Operation: null, Variables: { "email": "", "code": "CustomCode" } ``` Operation is **null**, where it is **get** if I run the query via the console. I can't see a way of settings this. The Android side of things look like this ``` private fun getEmailCodeRequest(email: String, code: String): GraphQLRequest<ClubMember> { val document = ( "query get(\$email: String!, \$code: String!) { " + "membersEmailByInviteCode(email: \$email inviteCode: { eq: \$code} ) { " + "items { " + "id " + "} " + "} " + "}") return SimpleGraphQLRequest( document, mapOf("email" to email, "code" to code),, GsonVariablesSerializer()) } ``` and ``` Amplify.API.query(getEmailCodeRequest(email.text.toString(), code.text.toString()), ``` I have been able to create a record using GraphQL, and I'm using auth and Rest API, so my app is working OK with the Android SDK. It just I can't get this to work. Anyone got any ideas? Thanks
asked 2 days ago