1
votes

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.

I've tried to build a simple lambda using:

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?

1
Did you use serverless offline pluginNiroshan Ranapathi
No? I did not use itCC.
how did you run lambda in local ?Niroshan Ranapathi
I've updated the questionCC.

1 Answers

0
votes

Try installing Maven or ensure that 'mvn' is on your PATH.

For me on Mac 'brew install maven' did the trick.