feat(bedrock): detect SSO token expiration and provide actionable error#1988
feat(bedrock): detect SSO token expiration and provide actionable error#1988loafoe wants to merge 1 commit intosipeed:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a more actionable error message for AWS Bedrock Converse calls when AWS SSO credentials are expired, guiding users to re-authenticate via aws sso login.
Changes:
- Detect SSO-token-related failures on
Converseerrors and return a targeted “SSO session expired” message. - Add unit tests for the SSO token error detection helper.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/providers/bedrock/provider_bedrock.go | Adds SSO-expiration detection and wraps Converse errors with an actionable message. |
| pkg/providers/bedrock/provider_bedrock_test.go | Adds tests validating isSSOTokenError behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
When AWS SSO credentials expire, provide a clear error message instructing the user to run 'aws sso login' to refresh their session.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@yinwm small change to improve error messaging for bedrock, mostly when developing |
📝 Description
When AWS SSO credentials expire, the Bedrock provider now detects the specific error and provides a clear, actionable message instructing users to refresh their session.
Before:
After:
The detection is conservative - it only matches SSO-specific error patterns (SSO OIDC, cached SSO token errors, InvalidGrantException) to avoid misclassifying other AWS credential failures like STS ExpiredToken.
🗣️ Type of Change
🤖 AI Code Generation
🔗 Related Issue
Follows up on #1903 (AWS Bedrock provider)
📚 Technical Context (Skip for Docs)
aws sso login, credentials are cached but will eventually expire. The original error message from the AWS SDK is cryptic and doesn't clearly indicate the solution.🧪 Test Environment
📸 Evidence (Optional)
Click to view test results
☑️ Checklist