AWS lambda的功能URL无API网关在GO中
我有一个由API网关调用的Lambda功能。 该函数正在使用此代码使用GET方法来工作:
func handleRequest(ctx context.Context, request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {
// add code here
return events.APIGatewayProxyResponse{Body: request.Body, StatusCode: 200}, nil
}
func main() {
lambda.Start(handleRequest)
}
我有此 event.apigatewayproxyrequest
和 get
方法。但是,当我尝试将URL迁移到a ,我没有什么相似的设置 get
方法。 URL应该如何知道在邮递员中使用哪种方法?而且...
我们是否有 event.apigatewayproxyrequest
进行请求的等效内容?
当我用URL调用它时,我得到了 502
坏网关错误。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
lambda函数url的AWS事件是
events。 lambdafunctionurlrequest
和。因此,您的处理程序签名应该看起来像:
创建lambda的URL后,呼叫者(例如Postman)可以指定任何HTTP方法,您可以使用以下方式访问该方法:
The AWS event for Lambda Function URL is
events.LambdaFunctionURLRequest
and the related types.So your handler signature should look like:
Once you create the URL of your Lambda, the caller (e.g. Postman) can specify whatever HTTP method, which you can access inside your handler with: