abpframework/abp · error · AmazonS3Exception

Not found aws credentials

Error message

Not found aws credentials

What it means

Thrown by DefaultAmazonS3ClientFactory.GetAwsCredentials when UseCredentials is enabled and a ProfileName is configured, but CredentialProfileStoreChain.TryGetAWSCredentials cannot resolve that profile. It surfaces as an AmazonS3Exception because the explicitly-requested named profile was not found in the credential store (SDK credentials file / ProfilesLocation).

Source

Thrown at framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/DefaultAmazonS3ClientFactory.cs:104

        return Task.FromResult(clientConfig);
    }

    protected virtual AWSCredentials? GetAwsCredentials(
        AwsBlobProviderConfiguration configuration)
    {
        if (configuration.ProfileName.IsNullOrWhiteSpace())
        {
            return null;
        }

        var chain = new CredentialProfileStoreChain(configuration.ProfilesLocation);

        if (chain.TryGetAWSCredentials(configuration.ProfileName, out var awsCredentials))
        {
            return awsCredentials;
        }

        throw new AmazonS3Exception("Not found aws credentials");
    }

    protected virtual async Task<SessionAWSCredentials> GetTemporaryCredentialsAsync(
        AwsBlobProviderConfiguration configuration)
    {
        var temporaryCredentialsCache = await Cache.GetAsync(configuration.TemporaryCredentialsCacheKey!);

        if (temporaryCredentialsCache == null)
        {
            AmazonSecurityTokenServiceClient stsClient;

            if (!configuration.AccessKeyId.IsNullOrEmpty() && !configuration.SecretAccessKey.IsNullOrEmpty())
            {
                stsClient = new AmazonSecurityTokenServiceClient(configuration.AccessKeyId,
                    configuration.SecretAccessKey);
            }
            else
            {

View on GitHub (pinned to 7ed43b1931)

Solutions

  1. Verify the profile exists in the credentials file (aws configure list-profiles) and the name matches ProfileName exactly.
  2. Set ProfilesLocation to the absolute path of the credentials file when running in a non-default environment (container/service).
  3. If you do not need a named profile, clear ProfileName so the factory returns null and the SDK default credential chain is used.
  4. Alternatively switch to explicit AccessKeyId/SecretAccessKey or temporary credentials.

Example fix

// before
"Aws": {
  "UseCredentials": true,
  "ProfileName": "prod"
}

// after (explicit profile path)
"Aws": {
  "UseCredentials": true,
  "ProfileName": "prod",
  "ProfilesLocation": "/var/app/.aws/credentials"
}

// after (drop named profile, use default chain)
"Aws": {
  "UseCredentials": true
}
Defensive patterns

Strategy: validation

Validate before calling

if (!cfg.ProfileName.IsNullOrWhiteSpace())
{
    var chain = new CredentialProfileStoreChain(cfg.ProfilesLocation);
    if (!chain.TryGetAWSCredentials(cfg.ProfileName, out _))
        throw new InvalidOperationException($"AWS profile '{cfg.ProfileName}' not found at '{cfg.ProfilesLocation}'.");
}

Type guard

bool profileResolves =
    cfg.ProfileName.IsNullOrWhiteSpace() ||
    new CredentialProfileStoreChain(cfg.ProfilesLocation).TryGetAWSCredentials(cfg.ProfileName, out _);

Try / catch

try { await container.SaveAsync(name, stream); }
catch (AmazonS3Exception ex) when (ex.Message == "Not found aws credentials")
{ /* install/fix the named profile or drop ProfileName */ }

Prevention

When it happens

Trigger: AwsBlobProviderConfiguration.UseCredentials=true with a non-empty ProfileName, where the profile does not exist in the AWS credentials file at ProfilesLocation (or the default location when ProfilesLocation is null). The factory throws instead of falling back to the default credential chain.

Common situations: Deploying to a server/container that lacks the ~/.aws/credentials file, misspelling the profile name, pointing ProfilesLocation at the wrong path, or running under an identity whose home directory has no credentials file.

Related errors


AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13). Data as JSON: /api/errors/bd181bcb07e34de7. Report an issue: GitHub.