如何在本地测试AWS Lambda函数

编程入门 行业动态 更新时间:2024-10-28 00:24:44
本文介绍了如何在本地测试AWS Lambda函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个使用node.js express开发的移动应用程序后端.我尝试将其部署为lambda服务.为此,我创建了一个无服务器框架项目( github/serverless ).以前,我通过启动快速后端应用程序在本地测试了移动应用程序.现在,我找不到没有本地后端就可以在本地测试我的移动应用程序的方法. jaws run命令仅在我调用它后运行.

I have a mobile application backend developed with node.js express. I tried it to deploy it as lambda service. For that I created a Serverless Framework project (github/serverless). Previously I tested mobile app locally by starting express backend application. Now I can't find a method to test my mobile app locally without local backend. jaws run command only run once I called it.

是否有任何方法可以将lambda函数作为Web服务启动?还是没有Serverless Framework的替代品?

Is there any method to start the lambda function as a web service? Or is there any alternative to Serverless Framework?

推荐答案

目前看来尚无办法,但1.4.0版即将发布,其中应包括一个新的命令下巴服务"应该可以解决您的问题.

It doesn't look like there's way to do this right now, but version 1.4.0 is about to be released and, among other things, it should include a new command "jaws serve" which should address your problem.

这里是PR: github/jaws-framework/JAWS/pull/269

更新:您现在可以为此使用新的 serverless-serve 插件.

UPDATE: you can now use the new serverless-serve plugin for this.

更新2:无服务器服务已经有一段时间没有更新了,看起来 serverless-offline 是现在可以更好地模拟Lambda函数.

UPDATE 2: serverless-serve hasn't been updated in a while, it looks like serverless-offline is a much better option now to emulate Lambda functions.

更多推荐

如何在本地测试AWS Lambda函数

本文发布于:2023-11-28 09:20:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1641825.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:函数   测试   如何在   AWS   Lambda

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!