AWS Lambda Authorizer`event`对象中没有`body`参数 [英] `body` parameter is absent in AWS Lambda Authorizer `event` object

查看:148
本文介绍了AWS Lambda Authorizer`event`对象中没有`body`参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

事件对象缺少bodyisBase64Encoded属性.但是它们应该根据

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?

推荐答案

在自定义授权者请求类型中,传递给授权者的事件中没有正文.根据文档:

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

对于REQUEST类型的自定义授权者,API网关将所需的请求参数作为事件对象的一部分传递给授权者Lambda函数.受影响的请求参数包括标头,路径参数,查询字符串参数,阶段变量和一些请求上下文变量.

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.

没有身体!

这篇关于AWS Lambda Authorizer`event`对象中没有`body`参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆