aws-java-simple-http-endpoint needs to updated/replaced for the current post 2.0.0 serverless framework
Tried using aws-java-simple-http-endpoint something like:
git clone https://github.com/serverless/examples.git
cd examples/aws-java-simple-http-endpoint
mvn package
npm init
.
.
.
npm install --save-dev serverless
alias serverless=./node_modules/serverless/bin/serverless.js
alias sls=./node_modules/serverless/bin/serverless.js
'edit serverless.yml to change artifact: build/distributions/aws-java-simple-http-endpoint.zip -> artifact: target/aws-java-simple-http-endpoint.jar'
sls invoke local -f currentTime
and get
Serverless Error ---------------------------------------
The Serverless version (2.21.1) does not satisfy the "frameworkVersion" (>=1.2.0 <2.0.0) in serverless.yml
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: darwin
Node Version: 12.18.1
Framework Version: 2.21.1 (local)
Plugin Version: 4.4.2
SDK Version: 2.3.2
Components Version: 3.6.0
Hello @terrybondy :wave: Thanks a lot for reporting that issue, that's indeed the case and the example needs to be updated. We'd be more than happy to accept a PR for that improvement :tada:
Sorry, I can’t. A little too far down the rabbit hole for me. I’m having a problem with latest serverless with a simple ‘hello world’-like maven built java package and was looking for an example that should work.
Just getting started using serverless for real work with Java after dabbling with it last November with python. So far having a bad ‘out-of-the-box’ experience with serverless. ☹
Terry
From: Piotr Grzesik [email protected] Reply-To: serverless/examples [email protected] Date: Friday, January 29, 2021 at 10:41 AM To: serverless/examples [email protected] Cc: Terry Bondy [email protected], Mention [email protected] Subject: Re: [serverless/examples] aws-java-simple-http-endpoint needs to updated/replaced for the current post 2.0.0 serverless framework (#578)
Hello @terrybondyhttps://github.com/terrybondy 👋 Thanks a lot for reporting that issue, that's indeed the case and the example needs to be updated. We'd be more than happy to accept a PR for that improvement 🎉
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/serverless/examples/issues/578#issuecomment-769880024, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHGXALCPMQSUAZSSWQ3LVH3S4LJKJANCNFSM4WY4T6JQ.
That's totally understood @terrybondy :100: I'm sorry to hear that - did you by any chance try using one of the templates such as aws-java-maven? What are the issues that you're experiencing? To be honest, some of the tooling and examples around Java might be a bit outdated as JS and Python are leading languages in the space. I'd love to hear what issues are your running into
Well, seeing as you have asked, and realizing this is unrelated to the above issue.
Doing this:
mkdir simple-http
cd simple-http
npm init
.
.
.
npm install --save-dev serverless
alias serverless=./node_modules/serverless/bin/serverless.js
alias sls=./node_modules/serverless/bin/serverless.js
sls create --help
sls create -t aws-java-maven
mvn package
<edit serverless.yml to look like attached serverless.txt file (can't attach .yml for some reason)
[serverless.txt](https://github.com/serverless/examples/files/5894971/serverless.txt)
>
export SLS_DEBUG=*
sls invoke local -f hello --log
produces the following output for the last step:
Serverless: Load command interactiveCli
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command config:tabcompletion
Serverless: Load command config:tabcompletion:install
Serverless: Load command config:tabcompletion:uninstall
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command upgrade
Serverless: Load command uninstall
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command generate-event
Serverless: Load command test
Serverless: Load command dashboard
Serverless: Load command output
Serverless: Load command output:get
Serverless: Load command output:list
Serverless: Load command param
Serverless: Load command param:get
Serverless: Load command param:list
Serverless: Load command studio
Serverless: Invoke invoke:local
Error --------------------------------------------------
Error: ENOENT: no such file or directory, stat '/Users/tbondy/Documents/git/tbondy/serverless/simple-http/node_modules/serverless/lib/plugins/aws/invokeLocal/runtimeWrappers/java/target'
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: darwin
Node Version: 12.18.1
Framework Version: 2.21.1 (local)
Plugin Version: 4.4.2
SDK Version: 2.3.2
Components Version: 3.6.0
I know it's a bit unrelated, but I was curious about what issues you're experiencing so we can better understand our shortcomings when it comes to improving experience for people trying Serverless Framework. In the above example, I'm not JVM expert, but I believe that instead of mvn package you should run mvn install - it seems like the target jar isn't available for local invocation
I will try that then.
Then also a problem with https://github.com/serverless/examples/blob/master/aws-java-simple-http-endpoint/README.md that will hopefully get fixed as part of this issue.
Same output as reported above after using these commands:
mvn clean install
sls invoke local -f hello --log
serverless.yml now looks like:
service: simple-http
frameworkVersion: '2'
provider:
name: aws
runtime: java8
package:
artifact: target/hello-dev.jar
functions:
hello:
handler: com.serverless.Handler
events:
- http:
path: users/create
method: get
and ran something like a manual git bisect changing serverless versions.
Works in 2.11.1, 2.13.0, 2.15.0
Doesn't work in 2.21.1, 2.16.1, 2.16.0
So broke in 2.16.0
Thanks @terrybondy, I've observed similar issues locally while trying to reproduce. As it seems to be a separate issue with java support for invoke local, could you please create a corresponding issue in https://github.com/serverless/serverless/issues ?
Note: There's also another bug reported related to invoke local with java: https://github.com/serverless/serverless/issues/4415
@pgrzesik I think this PR should fix the frameworkVersion issue #747