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

ProcessAWSCredentialIdentityResolver issue #1882

Open
conservative-dude opened this issue Feb 4, 2025 · 5 comments
Open

ProcessAWSCredentialIdentityResolver issue #1882

conservative-dude opened this issue Feb 4, 2025 · 5 comments
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@conservative-dude
Copy link

Describe the bug

I have AWS config file with profiles, each of them has credential_process set. I tried both ProcessAWSCredentialIdentityResolver and ProfileAWSCredentialIdentityResolver but I can't make it work.

If I run credential_process manually in terminal, I'm getting a proper json file

{
  "Version": 1,
  "SessionToken": "<REDACTED>",
  "AccessKeyId": "<REDACTED>",
  "SecretAccessKey": "<REDACTED>",
  "Expiration": "<REDACTED>"
}

Expected Behavior

I can use profiles with credential_process

Current Behavior

when I try to access S3, I get AwsCommonRuntimeKit.CommonRunTimeError.crtError(AwsCommonRuntimeKit.CRTError(code: 6159, message: "Valid credentials could not be sourced by the process provider", name: "AWS_AUTH_CREDENTIALS_PROVIDER_PROCESS_SOURCE_FAILURE")).

Reproduction Steps

            let identityResolver = try ProcessAWSCredentialIdentityResolver(profileName: "DEV")

            let config: S3Client.S3ClientConfiguration
            config = try await S3Client.S3ClientConfiguration(
                awsCredentialIdentityResolver: identityResolver,
                awsRetryMode: .standard,
                maxAttempts: 3,
                region: "us-west-2"
            )

            // Create an Amazon S3 client using the configuration created above.
            client = S3Client(config: config)

Possible Solution

No response

Additional Information/Context

No response

AWS SWIFT SDK version used

1.0.56

Compiler and Version used

XCode 16, Swift 6

Operating System and version

MacOS Sequoia

@conservative-dude conservative-dude added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 4, 2025
@jbelkins
Copy link
Contributor

jbelkins commented Feb 4, 2025

Have you tried using your configured process credential provider with AWS CLI?

$ aws sts get-caller-identity --profile DEV

where the DEV profile is configured per this guide:
https://docs.aws.amazon.com/sdkref/latest/guide/feature-process-credentials.html#feature-process-credentials-detail-path

Let us know if CLI works with your configuration.

@conservative-dude
Copy link
Author

conservative-dude commented Feb 5, 2025 via email

@sichanyoo
Copy link
Contributor

@conservative-dude Could you copy-paste your credential_process line in the config here, redacted as needed?

@conservative-dude
Copy link
Author

conservative-dude commented Feb 5, 2025 via email

@sichanyoo
Copy link
Contributor

sichanyoo commented Feb 5, 2025

Thanks for that.

Is it possible to use the path of mytoolname custom command in the config, similar to examples in both the official AWS CLI documentation and the official AWS SDK documentation where the path to the script is given instead of its name? Might be worth trying that.

I think what might be happening is that AWS CLI resolves the command successfully because AWS CLI uses same shell environment to invoke it, and as long as that command is in your PATH it finds it just fine. But Swift SDK might not be finding that command and just returning command not found error behind the scene (wrapped by that AwsCommonRuntimeKit error you saw) bc the way it resolves and runs the command is different to AWS CLI.

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. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

3 participants