-
Notifications
You must be signed in to change notification settings - Fork 759
support api key for bedrock #1295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
support api key for bedrock #1295
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added bearer token authentication support for Bedrock API. Code looks clean with proper early return pattern.
Important PR Review SkippedPR review skipped as per the configuration setting. Run a manually review by commenting /matter review 💡Tips to use Matter AICommand List
|
src/providers/bedrock/api.ts
Outdated
delete headers['content-type']; | ||
} | ||
|
||
if (isBearerTokenBasedAuth(providerOptions)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use awsAuthType to identify instead of deriving it from other details to keep the implementation aligned with how other providers support various auth modes.
fbc0776
to
87a4323
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant authentication logic and missing validation for API key based auth
if (awsAuthType === 'assumedRole') { | ||
await providerAssumedRoleCredentials(c, providerOptions); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐛 Bug
Issue: The if (awsAuthType === 'assumedRole')
check is duplicated, causing providerAssumedRoleCredentials
to be called twice when awsAuthType
is 'assumedRole'. This is redundant and could lead to unexpected behavior or performance issues.
Fix: Remove the first duplicated if
block (lines L160-L162) to ensure providerAssumedRoleCredentials
is called only once.
Impact: Improves code clarity, reduces redundancy, and prevents potential double execution of credential provisioning.
if (awsAuthType === 'assumedRole') { | |
await providerAssumedRoleCredentials(c, providerOptions); | |
} |
closes #1294
Currently there are two types of supported authentication for bedrock in portkey
This PR adds support for Bearer token based auth
Testing done:
Tested with combinations of assumed role, api secret and Bearer
precedence is for assumed role and api secret as we dont want to disturb existing deployments