fix(llm): fix boto3 metadata endpoint #491
Draft
+444
−431
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.
Fix: Prevent
boto3from attempting AWS credential lookup and IMDS connectionDescription:
This PR fixes
TimeoutErrorissues whereUiPathChatBedrockandUiPathChatBedrockConversewere attempting to connect to the AWS EC2 Instance Metadata Service (IMDS) at169.254.169.254.Root Cause:
Even with dummy values provided for
aws_access_key_idandaws_secret_access_key, the defaultboto3client configuration attempts to resolve credentials and sign requests. When running in environments without explicit AWS credentials (or on non-EC2 machines where the IMDS IP is unreachable),boto3would hang or timeout trying to fetch instance metadata.Since we are proxying requests through the UiPath LLM Gateway and not connecting directly to AWS, standard AWS authentication and region resolution are unnecessary.
Changes:
boto3client withbotocore.config.Config(signature_version=botocore.UNSIGNED). This explicitly tells the client that requests do not need to be signed, bypassing the credential resolution chain entirely.region_name="none"inUiPathChatBedrockandUiPathChatBedrockConverseinit methods to prevent thelangchain_awsbase classes from attempting to resolve a region from the environment.Benefit:
Eliminates unnecessary network calls to AWS endpoints/IMDS and resolves cryptic timeout errors during client initialization.
Development Package