fix(bedrock): opt into httpBearerAuth when apiKey is set#12212
Open
TianyiChen wants to merge 1 commit intocontinuedev:mainfrom
Open
fix(bedrock): opt into httpBearerAuth when apiKey is set#12212TianyiChen wants to merge 1 commit intocontinuedev:mainfrom
TianyiChen wants to merge 1 commit intocontinuedev:mainfrom
Conversation
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
I was using the config file from doc
it failed with
The apiKey value is correctly read into this.apiKey and the bearer-token branch at core/llm/llms/Bedrock.ts:74-81 is entered, but the AWS SDK silently falls back to SigV4 auth and tries to resolve IAM credentials, this is with @aws-sdk/client-bedrock-runtime 3.1017.0, the version resolved from the ^3.931.0 pin.
Without an explicit authSchemePreference, the resolver picks the first scheme (SigV4), ignores the supplied token, and invokes the IAM credential provider chain. Only the env-var path (AWS_BEARER_TOKEN_BEDROCK) works today, because the SDK auto-detects that and injects the preference for us.
(as
anybecauseBedrockRuntimeClientConfigtypesauthSchemePreferenceloosely across SDK minor releases — happy to drop if reviewers prefer.)AI Code Review
@continue-reviewChecklist
Screen recording or screenshot
[ When applicable, please include a short screen recording or screenshot - this makes it much easier for us as contributors to review and understand your changes. See this PR as a good example. ]
Tests
[ What tests were added or updated to ensure the changes work as expected? ]
Summary by cubic
Forces the Bedrock client to use HTTP Bearer auth when an
apiKeyis set, so the token is used instead of SigV4. Fixes "Could not load credentials from any providers" when using the documentedapiKeyconfig.authSchemePreference: ["httpBearerAuth"]whenapiKeyis provided to prevent@aws-sdk/client-bedrock-runtimefrom defaulting to SigV4/IAM.Written for commit aef2b14. Summary will update on new commits.