AWS API Gateway Custom Authorizer AuthorizerConfigurationException

前端 未结 4 383
天涯浪人
天涯浪人 2021-01-11 17:12

For a Kinesis stream, I created a proxy API using AWS API Gateway. I added a custom authorizer using python Lambda for the proxy. After publish of lambda function and deploy

4条回答
  •  不知归路
    2021-01-11 18:05

    I was facing the same error, in my case a nodejs function, I was adding one context key as array.

    {
      policyDocument: {
      Version: '2012-10-17',
      Statement: [{
        Action: 'execute-api:Invoke',
        Effect: effect,
        Resource: `${arn.split('/').slice(0, 2).join('/')}/*`,
      }],
    },
    context: {
      roles: ['admin']
    }
    

    As doc says:

    You can access the stringKey, numberKey, or booleanKey value (for example, "value", "1", or "true") of the context map in a mapping template by calling $context.authorizer.stringKey, $context.authorizer.numberKey, or $context.authorizer.booleanKey, respectively. The returned values are all stringified. Notice that you cannot set a JSON object or array as a valid value of any key in the context map.

    Remove the role key and it's working.

提交回复
热议问题