Serverless framework running Java code hangs

Viewed 453

I'm running Serverless 2.15.0 with Node 14.15.0. I've tried installing both with npm i -g and by using the curl script in the tutorial. I have Maven 3.6.3 installed

When I try to run a simple Java "hello world" function locally, I get this message:

Serverless: Building Java bridge, first invocation might take a bit longer.

Then Serverless just hangs. No error message, nothing. When I try to run with SLS_DEBUG=*, there are no messages after that point.

The only thing I've been able to Google is this, but there isn't any resolution to the problem. The other thing I've found is this but there seems to be no java directory where Serverless is installed, so I can't manually compile the pom file.

Anyone know how to fix this problem?

1 Answers

The problem is that they moved the path of the java runtime wrapper. Base paths differ regarding install location.

NVM (global installation)

cd ~/.nvm/versions/node/v16.13.1/lib/node_modules/serverless/lib/plugins/aws/invoke-local/runtime-wrappers/java
mvn package

NPM (global installation)

cd ~/.npm-global/lib/node_modules/serverless/lib/plugins/aws/invokeLocal/runtimeWrappers/java
mvn package

Homebrew

cd /usr/local/Cellar/serverless/2.29.0/libexec/lib/node_modules/serverless/lib/plugins/aws/invokeLocal/runtimeWrappers/java
mvn package

Replace 2.29.0 with installed serverless version.

Related