简体   繁体   中英

I am getting this error when trying to user AWS CodeGuru

I am trying to use AWS CodeGuru Profiler and for some reason I am getting the following exception

04-15-2020 11:51:09 [Amazon-Profiler] INFO  software.amazon.codeguruprofilerjavaagent.CodeGuruProfilerSDKClient [configureAgent:69]    - Exception while calling agent orchestration.
java.lang.NullPointerException: Credentials must not be null.
    at software.amazon.awssdk.utils.Validate.paramNotNull(Validate.java:117)
    at software.amazon.awssdk.auth.signer.params.Aws4SignerParams.<init>(Aws4SignerParams.java:42)
    at software.amazon.awssdk.auth.signer.params.Aws4SignerParams$BuilderImpl.build(Aws4SignerParams.java:206)
    at software.amazon.awssdk.auth.signer.internal.BaseAws4Signer.sign(BaseAws4Signer.java:34)
    at software.amazon.awssdk.core.internal.http.pipeline.stages.SigningStage.signRequest(SigningStage.java:63)```


This is my code

new Profiler.Builder()
   .profilingGroupName("codeguru-profiling")
   .build().start();

If you don't set awsCredentialsProvider you are supposed to get a default one. The default one would be determined by the AWS credentials chain https://docs.aws.amazon.com/sdk-for-java/v2/developer-guide/credentials.html

Double check your credentials are available via one of the methods (eg setting environment variables).

It could be a bug in the CodeGuru SDK, its very new after all. In which case you can set the credentials directly:

new Profiler.Builder().profilingGroupName("my-profiling-group")
  .awsCredentialsProvider(new EnvironmentVariableCredentialsProvider()).build().start();

So downgrading the awssdk from 2.11.12 to 2.10.28 solved the problem. I have no idea why!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM