1 Answer
- Newest
- Most votes
- Most comments
-1
I got a basic query with a single return to work using the example GetItem pipeline function.
I went back to my original query and kept messing with it. I eventually got it to work using this:
import { util } from '@aws-appsync/utils';
export function request(ctx) {
return {
operation: 'Query',
index: 'userID-index',
query: {
expression: '#userID = :userID',
expressionValues: util.dynamodb.toMapValues({ ':userID': ctx.args.userID }),
expressionNames: { '#userID': 'userID' },
},
};
}
export function response(ctx) {
return ctx.result;
}
Important notes: Ensure you've got expressionNames and your query in the Schema is setup to return ________Connection. It is not necessary to return ctx.result.items in the function or the after mapping template.
answered 9 months ago
Relevant content
- asked 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 7 months ago
Do you have CLI access to your DynamoDB table?
I don't use CLI much, but I have access to it, yes.
Try do a GetItem from the CLI with the same parameters and see what result you get.