(error: unknown)
| 629 | } |
| 630 | |
| 631 | function isBedrockAuthError(error: unknown): boolean { |
| 632 | if (isEnvTruthy(process.env.CLAUDE_CODE_USE_BEDROCK)) { |
| 633 | // AWS libs reject without an API call if .aws holds a past Expiration value |
| 634 | // otherwise, API calls that receive expired tokens give generic 403 |
| 635 | // "The security token included in the request is invalid" |
| 636 | if ( |
| 637 | isAwsCredentialsProviderError(error) || |
| 638 | (error instanceof APIError && error.status === 403) |
| 639 | ) { |
| 640 | return true |
| 641 | } |
| 642 | } |
| 643 | return false |
| 644 | } |
| 645 | |
| 646 | /** |
| 647 | * Clear AWS auth caches if appropriate. |
no test coverage detected