Describe the bug
When AWS_BEARER_TOKEN_BEDROCK is set to an empty string (via export AWS_BEARER_TOKEN_BEDROCK=), boto3 treats it as a valid bearer token and uses it for authentication,
causing "incomplete signature" errors. The empty string should be treated as if the variable is unset.
Regression Issue
Expected Behavior
- Empty string should be ignored
- Fall back to AWS credentials (IAM role, assume role, etc.)
Current Behavior
- boto3 uses empty bearer token in HTTP request headers
- Requests fail with incomplete signature errors
- Only unset AWS_BEARER_TOKEN_BEDROCK works (not export AWS_BEARER_TOKEN_BEDROCK=)
Reproduction Steps
export AWS_BEARER_TOKEN_BEDROCK=
python3 << EOF
import boto3
import logging
boto3.set_stream_logger('', logging.DEBUG)
client = boto3.client('bedrock-runtime', region_name='us-east-1')
# Fails with incomplete signature error
# Debug log shows BEARER_TOKEN in request headers
EOF
Possible Solution
No response
Additional Information/Context
No response
SDK version used
boto3: 1.35.69; botocore: 1.35.69
Environment details (OS name and version, etc.)
macOS
Describe the bug
When AWS_BEARER_TOKEN_BEDROCK is set to an empty string (via export AWS_BEARER_TOKEN_BEDROCK=), boto3 treats it as a valid bearer token and uses it for authentication,
causing "incomplete signature" errors. The empty string should be treated as if the variable is unset.
Regression Issue
Expected Behavior
Current Behavior
Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
SDK version used
boto3: 1.35.69; botocore: 1.35.69
Environment details (OS name and version, etc.)
macOS