Asim
Asim

Reputation: 85

How to fetch AWS SSM parameter at startup in Quarkus Native Image without GraalVM build failure?

I am building a Quarkus application that runs as a native image with GraalVM. I need to fetch a decryption key from AWS Systems Manager (SSM) Parameter Store before the application starts, so I can decrypt my configuration values (DB credentials, third-party API keys, etc.).

I tried fetching the SSM parameter using AWS SDK v2 in a @Startup bean (or @PostConstruct), but I get the following build-time error when compiling to a native image:

Caused by: org.graalvm.compiler.debug.GraalError: com.oracle.svm.core.util.UserError$UserException: Class initialization of software.amazon.awssdk.awscore.client.config.AwsClientOption failed. 
This error is reported at image build time because class 
software.amazon.awssdk.awscore.client.config.AwsClientOption is registered for linking at image build time by command line and command line. 
Use the option '--initialize-at-run-time=software.amazon.awssdk.awscore.client.config.AwsClientOption' to explicitly request initialization of this class at run time.

Even when adding the following configuration in application.properties, the build still fails:

quarkus.native.additional-build-args=--initialize-at-run-time=software.amazon.awssdk.awscore.client.config.AwsClientOption

What I've Tried:

None of these approaches have worked, and the native image build always fails.


What I Need:

Any insights or workarounds would be greatly appreciated!

Upvotes: 0

Views: 13

Answers (0)

Related Questions