如何在本地测试AWS Lambda函数 [英] How to test aws lambda functions locally

查看:299
本文介绍了如何在本地测试AWS Lambda函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用node.js express开发的移动应用程序后端.我尝试将其部署为lambda服务.为此,我创建了一个无服务器框架项目( https://github.com/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 (https://github.com/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: https://github.com/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函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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