I have implemented a custom authorization module in AWS API Gateway
using python. Basically it might return something like this:
access = {
"principalId": "yyyyyyyy",
"policyDocument" : {
"Version": "2012-10-17",
"Statement": [
{
"Action": "execute-api:Invoke",
"Resource": [
"some-arn/*/GET/organisation"
],
"Effect": "Allow"
}
]
},
"context" : {
"organization_id": "123"
}
}
At the backend site i want to perform a GetItem on DynamoDb. The mapping template looks like this:
{
"TableName":"Organisation",
"Key":{
"id":{
"S":"$context.authorizer.organization_id"
}
}
}
However, i am receiving an error, since the context
variable seems to be empty:
Mon Jul 10 19:47:16 UTC 2017 : Endpoint request body after transformations: { ""
"TableName":"Organisation",
"Key":{
"id":{
"S":""
}
}
}
Mon Jul 10 19:47:16 UTC 2017 : Endpoint response body before transformations: {"__type":"com.amazon.coral.service#SerializationException"}
Any suggestions, what i am doing wrong here?
After a lot of testing, I found out that the problem does only appear when testing using AWS console. This issue is also covered here . Hopefully AWS will solve this issue any soon.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.