简体   繁体   English

Lambda AWS上的Webhook部署

[英]Webhook deployment on Lambda AWS

I am trying to deploy the Webhook Example for Google Actions found here onto Lambda AWS. 我正在尝试将此处找到的Google Actions Webhook示例部署到Lambda AWS上。

I was successful deploying and making the POST calls using ngrok. 我已成功使用ngrok部署和进行POST调用。 So, no problems there. 因此,那里没有问题。

But the issue i found is it uses Express node module for POST request calls. 但是我发现的问题是它使用Express节点模块进行POST请求调用。 Lambda AWS fails when the request is made to Express module. 向Express模块​​发出请求时,Lambda AWS失败。 So is there a way to make the POST call successful. 因此,有一种方法可以使POST调用成功。

I tried using Lambda-Express node module to deploy it, but it seems to have some issue as well. 我尝试使用Lambda-Express节点模块进行部署,但它似乎也存在一些问题。

Lambda AWS does not directly support an HTTP interface. Lambda AWS不直接支持HTTP接口。

One solution would be for you to use API Gateway which would allow you to translate the HTTPS POST that AoG sends, into a call to AWS Lambda. 一种解决方案是让您使用API网关 ,该网关将允许您将AoG发送的HTTPS POST转换为对AWS Lambda的调用。

In your lambda you will handle the request which comes in via the standard Lambda handler: 在您的lambda中,您将处理通过标准Lambda处理程序传入的请求:

function( event, context, callback );

instead of via Express. 而不是通过Express。 You would probably also want to remove Express from your code, which might sound like a lot of work, but I took a brief look at it when it was released and my impression was that the dependence on Express was minor and quite unnecessary. 您可能还想从代码中删除Express,这听起来可能需要做很多工作,但是我在发布它时做了简短的介绍,我的印象是对Express的依赖很小,而且完全没有必要。

The alternative would be to switch from Lambda to something HTTP based like Google App Engine which is also serverless (to a degree). 另一种选择是从Lambda切换到类似HTTP的某种形式,例如Google App Engine,它在某种程度上也没有服务器。 I guess that might be easier but I don't know what your other factors might be. 我想这可能会容易一些,但我不知道您的其他因素可能是什么。

I have come across this tutorial that explains the step by step process of connecting API.ai intent using the Lambda function. 我看过本教程,该教程逐步说明了使用Lambda函数连接API.ai意图的过程。

And if you follow the Google web hook example to deploy it to Lambda, then it's a wrong direction. 而且,如果您按照Google Web挂钩示例将其部署到Lambda,那么这是一个错误的方向。 Completely eliminate the express usage and also the Assistant class is not necessary when Lambda deployment is necessary. 完全消除明确的用法,并且当需要Lambda部署时,也不必使用Assistant类。

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

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