- Newest
- Most votes
- Most comments
You've identified a key aspect of how BatchGetItem works in AWS AppSync. When using BatchGetItem, you must indeed specify the actual DynamoDB table names as keys in the "tables" map, not the AppSync data source names.
This is by design in the BatchGetItem operation. According to the documentation, the "tables" field in BatchGetItem is a map where the table names (not data source names) are specified as the keys. The documentation states: "The DynamoDB tables to retrieve the items from. The value is a map where table names are specified as the keys of the map."
If your mapping template doesn't match the actual DynamoDB table structure, you'll likely encounter errors like "The provided key element does not match the schema" with a 400 status code.
This behavior differs from single-item operations like GetItem, which can work with the AppSync data source configuration. The difference exists because BatchGetItem is designed to retrieve items from multiple tables in a single operation, so it needs to explicitly reference the actual DynamoDB table names.
To resolve this issue, ensure your BatchGetItem request uses the actual DynamoDB table names in the "tables" map, not your AppSync data source names.
Sources
BatchGetItem - AWS AppSync
BatchGetItem - AWS AppSync
BatchGetItem - AWS AppSync Events
Troubleshooting and common mistakes in AWS AppSync - AWS AppSync
answered a year ago
Relevant content
asked 7 years ago
- AWS OFFICIALUpdated 4 years ago
