Hi,
I am following this guide to create a test REST api gw in front of a dynamo db table.
While the POST call tests work, when I try the GET to retrieve a username I always get a 404
Fri Feb 11 07:17:40 UTC 2022 : Endpoint request URI: https://dynamodb.us-east-1.amazonaws.com/?Action=Query
Fri Feb 11 07:17:40 UTC 2022 : Endpoint request headers: {Authorization=****************************************************************************************************************************************************************************************************************************************************************************************82e823, X-Amz-Date=20220211T071740Z, x-amzn-apigateway-api-id=2xxp28f39k, Accept=application/json, User-Agent=AmazonAPIGateway_2xxp28f39k, X-Amz-Security-Token=xxxxx
Fri Feb 11 07:17:40 UTC 2022 : Endpoint request body after transformations: {
"TableName": "users",
"IndexName": "username-index",
"KeyConditionExpression": "username = :val",
"ExpressionAttributeValues": {
":val": {
"S": "ABE"
}
}
}
Fri Feb 11 07:17:40 UTC 2022 : Sending request to https://dynamodb.us-east-1.amazonaws.com/?Action=Query
Fri Feb 11 07:17:40 UTC 2022 : Received response. Status: 404, Integration latency: 2 ms
this is my GET integration request application/json mapping template
{
"TableName": "users",
"IndexName": "username-index",
"KeyConditionExpression": "username = :val",
"ExpressionAttributeValues": {
":val": {
"S": "$input.params('username')"
}
}
}
If I test the query on dynamodb it works:
aws dynamodb query \
--table-name $tablename \
--index-name $indexname \
--key-condition-expression "username = :v1" \
--expression-attribute-values file://expression-attributes.json \
--select ALL_PROJECTED_ATTRIBUTES \
--return-consumed-capacity INDEXES
where file://expression-attributes.json
{
":v1": {"S": "ABE"}
}
gives
{
"Items": [
{
"realname": {
"S": "xxxxx"
},
"username": {
"S": "ABE"
},
"uid": {
"S": "fc1d4fa5-6157-47c7-85a7-3953e477b396"
}
}
any idea what I am missing?