Describe the feature
[0]
"type": "CredentialsProviderError",
"message": "Could not load credentials from any providers",
As a workaround creating a custom client seems to work. (I'm not sure how correct / resilient the below code is)
// Create a custom BedrockRuntimeClient with Bearer token authentication
const customClient = new BedrockRuntimeClient({
region: config.region,
// Provide dummy credentials to bypass the credential provider chain
// since we're using Bearer token authentication via the Authorization header
credentials: {
accessKeyId: "dummy",
secretAccessKey: "dummy",
},
requestHandler: {
requestTimeout: 30000,
httpsAgent: undefined,
handle: (request: any, context: any) => {
// Add Authorization header with Bearer token
request.headers = request.headers || {};
request.headers["Authorization"] = `Bearer ${config.awsBearerToken}`;
// Use the default request handler
const { NodeHttpHandler } = require("@smithy/node-http-handler");
const handler = new NodeHttpHandler();
return handler.handle(request, context);
},
},
});
Use Case
Sometimes hard to set up full IAM auth on dev machines and the env var key seems useful to simplify some flows. (but of course they come w/ a lot of warnings, not super secure etc.).
Proposed Solution
Recognise and use the AWS_BEARER_TOKEN_BEDROCK in the credentials lookup chain.
Other Information
No response
Acknowledgements
SDK version used
3.844.0
Environment details (OS name and version, etc.)
darwin/npm
Describe the feature
AWS_BEARER_TOKEN_BEDROCKenv var and instead complains about not being able to find any credentials[0][0]
As a workaround creating a custom client seems to work. (I'm not sure how correct / resilient the below code is)
Use Case
Sometimes hard to set up full IAM auth on dev machines and the env var key seems useful to simplify some flows. (but of course they come w/ a lot of warnings, not super secure etc.).
Proposed Solution
Recognise and use the
AWS_BEARER_TOKEN_BEDROCKin the credentials lookup chain.Other Information
No response
Acknowledgements
SDK version used
3.844.0
Environment details (OS name and version, etc.)
darwin/npm