

# Troubleshooting the Secrets Manager extension in AWS Systems Manager Cloud Extensions

Find solutions to common problems with the Secrets Manager extension, such as refused requests, stale secrets, and role errors.

**Topics**
+ [Requests are refused](#cloud-extensions-ext-secrets-manager-troubleshooting-requests-are-refused)
+ [Your application reads an old secret](#cloud-extensions-ext-secrets-manager-troubleshooting-your-application-reads-an-old-secret)
+ [Decryption failures](#cloud-extensions-ext-secrets-manager-troubleshooting-decryption-failures)
+ [Prefetched secrets aren't in the cache](#cloud-extensions-ext-secrets-manager-troubleshooting-prefetched-secrets-arent-in-the-cache)
+ [A role can't be assumed](#cloud-extensions-ext-secrets-manager-troubleshooting-a-role-cant-be-assumed)
+ [The extension returns 429 errors](#cloud-extensions-ext-secrets-manager-troubleshooting-the-extension-returns-429-errors)

## Requests are refused
<a name="cloud-extensions-ext-secrets-manager-troubleshooting-requests-are-refused"></a>

**Symptom:** The extension refuses requests from your application.

Check the following causes:

1. **The request isn't signed** – By default, the runtime requires SigV4. An unsigned request returns `401 MissingAuthenticationToken`. A bad signature, a wrong access key ID, or a request time more than 5 seconds off returns `403`.

1. **The token is missing** – If the server-side request forgery (SSRF) token header check is on, each query and path request must carry the token. Send the token in one of the SSRF token headers. A missing or wrong token returns `403 InvalidSsrfTokenException`. Check the **SSRF token headers** setting for the header names.

1. **The request carries an X-Forwarded-For header** – The extension refuses these requests with `400 BadRequestException` whether the SSRF token header check is on or off.

1. **The extension hasn't finished loading** – The extension returns `503 ServiceUnavailableException` until it finishes loading. Retry after a short time.

## Your application reads an old secret
<a name="cloud-extensions-ext-secrets-manager-troubleshooting-your-application-reads-an-old-secret"></a>

**Symptom:** A secret changed or rotated in Secrets Manager, but your application still reads the old value.

The extension serves a cached secret until the cache time to live (TTL) expires. To get the new value now, add `refreshNow=true` to the request. To get new values sooner in general, check the **Cache TTL** setting, and lower the value:

```bash
aws cloudextensions get-profile-entry \
  --profile-identifier my-application \
  --identifier {{profile-entry-id}} \
  --query 'effectiveSettings'
```

A value of 0 makes the extension check Secrets Manager on every request.

## Decryption failures
<a name="cloud-extensions-ext-secrets-manager-troubleshooting-decryption-failures"></a>

**Symptom:** Errors when the extension retrieves a secret that a customer managed AWS Key Management Service (AWS KMS) key encrypts.

Check that the IAM execution role allows `kms:Decrypt` on the KMS key:

```json
{
  "Effect": "Allow",
  "Action": "kms:Decrypt",
  "Resource": "arn:aws:kms:region:account-id:key/key-id"
}
```

## Prefetched secrets aren't in the cache
<a name="cloud-extensions-ext-secrets-manager-troubleshooting-prefetched-secrets-arent-in-the-cache"></a>

Check that each **Secret ID** and each **Tag key** is correct. Check that the execution role, or the role in **Role ARN**, can read the secrets. For tag filters, check that the role has `secretsmanager:ListSecrets`, and for any prefetch, check that the role has `secretsmanager:BatchGetSecretValue` on `*`. A request by ARN, or with `versionId` or `versionStage`, doesn't use a prefetched entry. Check the logs of the extension in CloudWatch Logs.

## A role can't be assumed
<a name="cloud-extensions-ext-secrets-manager-troubleshooting-a-role-cant-be-assumed"></a>

**Symptom:** A request with `roleArn` returns `400 AccessDeniedException`.

Check that the principal of the extension has `sts:AssumeRole` permission on the target role. Also check that the trust policy of the target role allows the principal to assume the role.

## The extension returns 429 errors
<a name="cloud-extensions-ext-secrets-manager-troubleshooting-the-extension-returns-429-errors"></a>

**Symptom:** Requests to the extension fail with `429 ThrottlingException`.

The extension has too many calls in flight. The limit is 100, and the limit is lower under memory pressure. Retry after the time in the `Retry-After` header.