-
Notifications
You must be signed in to change notification settings - Fork 845
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
ProfileFileSupplier.defaultSupplier() leads to NullPointer when config files are missing #5635
Comments
maschnetwork
added
bug
This issue is a bug.
needs-triage
This issue or PR still needs to be triaged.
labels
Sep 30, 2024
Acknowledged. We should fix the NullPointerException. |
debora-ito
added
p2
This is a standard priority issue
and removed
needs-triage
This issue or PR still needs to be triaged.
labels
Oct 10, 2024
@debora-ito do you have any timelines in mind for when to expect the fix? |
I also agree with the solution @maschnetwork has mentioned, that we could assign a the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
We recently introduced automatic credentials reload in the EventBridge Kafka connector by leveraging ProfileFileSupplier.defaultSupplier as recommended in the official docs:
However, when no credential files are present (~/.aws/credentials and ~/.aws/config are missing) the DefaultCredentialProviderChain.resolveCredentials() process will result in NullPointer Exceptions in both ProfileCredentialsProvider and InstanceProfileCredentialProvider:
java.lang.NullPointerException: Cannot invoke "java.nio.file.Path.getFileSystem()" because "path" is null
. (See Additional Information below).This will happen first in the
ProfileCredentialsProvider
and will be ignored to move to the next provider as outlined here. But the process will run into it again for the InstanceProfileCredentialProvider, for example in Ec2MetaDataConfigProvider.This behavior essentially influences (and breaks) the DefaultCredentialsProvider chain. It behaves differently than the current SDK default value
ProfileFile.defaultProfileFile()
which does not produce any exceptions and lets InstanceProfileCredentialProvider resolve even though files are missing.Related issues:
awslabs/eventbridge-kafka-connector#396
Expected Behavior
ProfileFileSupplier.defaultSupplier() behaves the same as ProfileFile.defaultProfileFile() when credential files are missing.
Current Behavior
ProfileFileSupplier.defaultSupplier() leads to Nullpointer during resolution process and breaks DefaultCredentialsProvider (or at least behaves different than the default)
Reproduction Steps
Possible Solution
When no credential files are present (~/.aws/credentials and ~/.aws/config. are missing)
ProfileFileSupplier.defaultSupplier() effectively returns
ProfileFile.builder().build()
since credentialsSupplierOptional and configurationSupplierOptional are empty. Later during resolveCredentials of the DefaultCredentialsProviderChain the contentLocation within ProfileFile Builder will be null and therefore lead to the Nullpointer:It would make sense to provide a sane default here such as ProfileFile.defaultProfileFile().
Additional Information/Context
This will happen first in the
ProfileCredentialsProvider
and will be ignored to move to the next provider as outlined here. But InstanceProfileCredentialProvider will run into it again, for example in Ec2MetaDataConfigProvider.AWS Java SDK version used
2.28.8
JDK version used
17
Operating System and version
MacOS
The text was updated successfully, but these errors were encountered: