Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Exceptions in Spring native app are not being returned to lambda as response instead the lambda is timing out. #1568

@atyamlalithya

Description

@atyamlalithya

Hi,

I am using Spring cloud function version 3.2.1 and Spring native 0.11.1 to build a native image using GRAALVM. I am deploying the native zip in AWS lambda function with 'Custom runtime on Amazon Linux 2' as Runtime.

My function has to throw an ResponseStatusException in case of bad requests and i defaulted it in the sample for the sake of simplicity.

@component
public class AddFunction implements Function<String, String> {

@OverRide
public String apply(String user){
if (true) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "errorResponse");
}
return "Added user";
}

When I run this as a spring boot application / upload the jar with java11 runtime in lambda , I am getting 400 bad request response as expected. Whereas when I build a native linux image and run it through bootstrap in lambda, I can see that ResponseStatusException is printed in stack trace(logs) but the lambda is continuing to run and timing out. I want the native application to return the 400 bad request as a response to lambda like the regular jar.

Attaching the sample project to reproduce the issue, zip file I used as source in lambda and also screenshots of
demo.zip
the logs
lambdaLog
LambdaTimeOutError
demo-zip.zip

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions