Skip to content
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

Expected a profile or property definition on line 190 #2994

Closed
giacomoarru opened this issue Jan 26, 2022 · 5 comments
Closed

Expected a profile or property definition on line 190 #2994

giacomoarru opened this issue Jan 26, 2022 · 5 comments
Labels
bug This issue is a bug. p3 This is a minor priority issue

Comments

@giacomoarru
Copy link

giacomoarru commented Jan 26, 2022

Describe the bug

AWS SDK 2.17.118

My credentials file is valid and the profiles all work with aws cli.
When a the ~/.aws/credentials file contains a credential in this format (parameters indented with spaces)
[profile_name]
(4 space indentation)region = region_name
(4 space indentation)credential_process = ....................

I get this exception:

java.lang.IllegalArgumentException: Expected a profile or property definition on line 190
at software.amazon.awssdk.utils.Validate.isTrue(Validate.java:76)
at software.amazon.awssdk.profiles.internal.ProfileFileReader.readPropertyContinuationLine(ProfileFileReader.java:167)
at software.amazon.awssdk.profiles.internal.ProfileFileReader.parseLine(ProfileFileReader.java:76)
at software.amazon.awssdk.profiles.internal.ProfileFileReader.lambda$parseFile$0(ProfileFileReader.java:58)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
at software.amazon.awssdk.profiles.internal.ProfileFileReader.parseFile(ProfileFileReader.java:58)
at software.amazon.awssdk.profiles.ProfileFile$BuilderImpl.build(ProfileFile.java:266)
at software.amazon.awssdk.profiles.ProfileFile.lambda$addCredentialsFile$0(ProfileFile.java:142)
at java.base/java.util.Optional.ifPresent(Optional.java:178)
at software.amazon.awssdk.profiles.ProfileFile.addCredentialsFile(ProfileFile.java:139)
at software.amazon.awssdk.utils.builder.SdkBuilder.applyMutation(SdkBuilder.java:61)
at software.amazon.awssdk.profiles.ProfileFile.defaultProfileFile(ProfileFile.java:90)
at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.mergeGlobalDefaults(SdkDefaultClientBuilder.java:205)
at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.syncClientConfiguration(SdkDefaultClientBuilder.java:158)
at software.amazon.awssdk.services.s3.DefaultS3ClientBuilder.buildClient(DefaultS3ClientBuilder.java:27)
at software.amazon.awssdk.services.s3.DefaultS3ClientBuilder.buildClient(DefaultS3ClientBuilder.java:22)
at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.build(SdkDefaultClientBuilder.java:133)

Expected behavior

The SDK should bootstrap with no exceptions.

Current behavior

An exception is thrown at initialization.

Steps to Reproduce

Indent the configuration in a aws profile, credentials file ~/.aws/credentials

Possible Solution

Trim the parameters

Context

My software stopped bootstrapping after I added a new AWS profile.

AWS Java SDK version used

2.17.118

JDK version used

16

Operating System and version

Ubuntu 20.04

@giacomoarru giacomoarru added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 26, 2022
@debora-ito
Copy link
Member

Hi @giacomoarru I can see the error too.

When a line starts with spaces, the Java SDK expects it to be a continuation of a configuration from the previous line.
Not sure how the cli deals in this case but we can investigate, marking this as a bug.

Can you use the credentials file without spaces in the meantime?

@debora-ito debora-ito removed the needs-triage This issue or PR still needs to be triaged. label Jan 27, 2022
@giacomoarru
Copy link
Author

Hi @debora-ito, I have removed the initial spaces in my credentials file.
The notable thing to me is that I use the builder pattern and provide the SDK with credentials from Secrets Manager, so I do not use the profile at all - but it is still parsed.

Thank you,
Giacomo

@yasminetalby yasminetalby added the p3 This is a minor priority issue label Nov 12, 2022
@usmanovbf
Copy link

The same problem, still actual

@debora-ito
Copy link
Member

@giacomoarru I'm going to close this issue, this won't be prioritized soon.

The "Shared config file" reference guide show examples of lines where indentation is used to indicate a subsetting. The Java SDK is following what is documented.

The workaround is to not use indentation before a setting name.

Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p3 This is a minor priority issue
Projects
None yet
Development

No branches or pull requests

4 participants