Skip to content

AWS_BEARER_TOKEN_BEDROCK with empty string causes incomplete signature errors #3603

@shixions

Description

@shixions

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

  • Select this option if this issue appears to be a regression.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    guidanceQuestion that needs advice or information.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions