-
Notifications
You must be signed in to change notification settings - Fork 628
Feature Request: Make Spring AOT play nice when using AWS FunctionInvoker #1113
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
Labels
Milestone
Comments
FYI I've tested this by copying FunctionInvoker and adding the above change - Spring AOT works great :-) |
davidmelia
added a commit
to davidmelia/spring-cloud-function
that referenced
this issue
Feb 29, 2024
@olegz - would it be possible to review my PR? I believe there is a spring cloud release 26/03/2024 so it would be great to target this if you agree with the PR. The change itself is simple but depends if it has implications elsewhere?? |
Yes, sorry, will review shortly |
Merged |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
OK this might be a funny one to describe:
Currently we're using custom images, for SCF AWS Lambdas, and rely on the AWS SCF FunctionInvoker class (SCF 4.1.0 / SB 3.2.3) such that when we start the lambda we have
java ... com.amazonaws.services.lambda.runtime.api.client.AWSLambda org.springframework....FunctionInvoker
We're testing some of the features from this spring article including CDS and AOT. So far CDS has been fine but AOT is an issue for the following reasons:
String initializerClassName = "com.amazonaws.services.lambda.runtime.api.client.AWSLambda" + "__ApplicationContextInitializer";
Describe the solution you'd like
This needs thinking in case it's a breaking change but could we be opinionated in FunctionInvoker.start() to amend
SpringApplication.run(new Class[] {startClass, AWSCompanionAutoConfiguration.class}, properties)
to
new SpringApplicationBuilder().main(startClass).sources(new Class[] {startClass, AWSCompanionAutoConfiguration.class}).run(properties);
I think in this case the SpringApplication main class should not be deduced and instead set to the function start class.
If you think this makes sense I'm more than happy to provide a PR :-)
Describe alternatives you've considered
AOT does work fine if we use the CustomRuntimeEventLoop (and therefore remove com.amazonaws.services.lambda.runtime.api.client.AWSLambda from the path) however with this approach we cannot then use FUNCTION_INVOKER_LATE_INITIALIZATION which is important to us to stop AWS Init Timeout issues.
The text was updated successfully, but these errors were encountered: