[英]Not able to invoke locally AWS Lambda using Serverless
I have a problem and maybe someone can help me. 我有问题,也许有人可以帮助我。 I'm trying to build a simple java aws lambda and deploy it using serverless framework. 我正在尝试构建一个简单的java aws lambda并使用无服务器框架进行部署。
I've tried to build a simple lambda using: 我尝试使用以下方法构建一个简单的lambda:
sls create --template aws-java-maven --name test-lambda
mvn clean install package
sls deploy
When I try to invoke the remote function using 当我尝试使用调用远程功能时
sls invoke --function hello -d '{}'
it works. 有用。
But when I try to invoke it locally, I have the following error: 但是,当我尝试在本地调用它时,出现以下错误:
Serverless: Building Java bridge, first invocation might take a bit longer.
events.js:183
throw er; // Unhandled 'error' event
^
Error: spawn mvn ENOENT
at _errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickDomainCallback (it worksinternal/process/next_tick.js:218:9)
EDIT: To run it locally I use: 编辑:要在本地运行它,我使用:
sls invoke local -f hello
I've googled it and I found nothing. 我已经用谷歌搜索了,但没有发现任何东西。 I don't understand the error. 我不明白这个错误。 It looks like something about maven? 看起来像关于Maven的事情?
Try installing Maven or ensure that 'mvn' is on your PATH. 尝试安装Maven或确保“ mvn”在您的PATH上。
For me on Mac 'brew install maven' did the trick. 对我来说,在Mac上“ brew install maven”成功了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.