简体   繁体   English

AWS Lambda API网关定义路径参数节点Js-不起作用

[英]AWS Lambda API Gateway Define Path Parameters Node Js - Not Working

I have tried following the documentation to have path parameters filter the dynamodb scan. 我尝试按照文档进行操作,以使路径参数过滤dynamodb扫描。

I am trying to filter on userID. 我正在尝试过滤userID。 I have used API gateway to use the path as a parameter {userID} and used lambda to look for the path parameter to filter. 我已使用API​​网关将路径用作参数{userID},并使用lambda查找要过滤的路径参数。 When I hardcode a userID in the lambda function it works perfectly so there seems to be a disconnect in the function getting the path parameter. 当我在lambda函数中对userID进行硬编码时,它可以正常工作,因此在获取path参数的函数中似乎断开连接。

lambda function: lambda函数:

lambda函数

apigateway path: apigateway路径:

apigateway路径

usually "$input.params" uses in body mapping templates. 通常在主体映射模板中使用“ $ input.params”。 You can create a body mapping template in integration request and you can get params inside Lambda function like an event.UserID, 您可以在集成请求中创建主体映射模板,并且可以在Lambda函数内部获取参数,例如event.UserID,

http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html#input-variable-reference http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html#input-variable-reference

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM