Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After deployment of a Springboot Lambda, the StreamHandler is never found #337

Closed
thomashoef opened this issue Apr 20, 2020 · 2 comments
Closed

Comments

@thomashoef
Copy link

  • Implementations: Spring Boot

Scenario

After manually migrating a spring boot App to Lambda, or by downloading the springboot2 sample and running "sam deploy --guided", a regular Lambda gets deployed successfully on AWS. When testing and running the lambda, the result though is always a ClassNotFoundException.

Expected behavior

The Streamhandler class which is well present in the uploaded artefact is found.

Actual behavior

{
  "errorMessage": "Class not found: com.amazonaws.serverless.sample.springboot2.StreamLambdaHandler",
  "errorType": "java.lang.ClassNotFoundException"
}

Steps to reproduce

Take the springboot2 sample, run mvn package and then sam deploy --guided and wait for the resources to be created, then test the Lambda function. Note that "sam build" will not work if you only have maven installed.

Full log output

see above

@sapessi
Copy link
Collaborator

sapessi commented Apr 20, 2020

I looked into it. What is happening is that the template.yml file has the CodeUri property set to the current folder. This means that when you try to deploy it with sam deploy --guided it looks for the compiled application under ./.aws-sam/build/PetStoreFunction. If you mvn clean package manually the output is a zip file under the target folder. I suspect that's the reason I cannot find the class, it uploaded to Lambda the contents of the .aws-sam folder which is empty.

I'll look for a way to make sam build work with maven only.

@sapessi
Copy link
Collaborator

sapessi commented Apr 21, 2020

Closing in favor of #336

@sapessi sapessi closed this as completed Apr 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants