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