`body` parameter is absent in AWS Lambda Authorizer `event` object

与世无争的帅哥 提交于 2019-12-20 03:21:41

问题


The event object is missing body and isBase64Encoded properties. But they should be there according to the docs The full structure is the following:

{
    "type": "REQUEST",
    "methodArn": "arn:aws:execute-api:us-west-2:*******:*******/development/POST/auth/login",
    "resource": "/{proxy+}",
    "path": "/auth/login",
    "httpMethod": "ANY",
    "headers": {
       .....
    },
    "queryStringParameters": {
        "test": "123"
    },
    "pathParameters": {
        "proxy": "auth/login"
    },
    "stageVariables": {
        "lambdaVersion": "development"
    },
    "requestContext": {
        "path": "/development/auth/login",
        "accountId": "*****",
        "resourceId": "f8wvnk",
        "stage": "development",
        "requestId": "****",
        "identity": {
            ....
        },
        "resourcePath": "/{proxy+}",
        "httpMethod": "POST",
        "apiId": "********"
    }
}

Does anyone have the similar issue?


回答1:


In custom authorizer request type there is no body in the passed event to the authorizer. According to the documentation:

For a custom authorizer of the REQUEST type, API Gateway passes the required request parameters to the authorizer Lambda function as part of the event object. The affected request parameters include headers, path parameters, query string parameters, stage variables, and some of request context variables.

NO Body is there!



来源:https://stackoverflow.com/questions/47335042/body-parameter-is-absent-in-aws-lambda-authorizer-event-object

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!