Skip to content

Conversation

roeybc
Copy link
Contributor

@roeybc roeybc commented Oct 2, 2025

Added support to endpoint_url when calling amazon bedrock. This is needed to support private endpoints behind VPCs on aws.

Copy link

vercel bot commented Oct 2, 2025

@roeybc is attempting to deploy a commit to the Boundary Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

🔒 Entelligence AI Vulnerability Scanner

No security vulnerabilities found!

Your code passed our comprehensive security analysis.


Comment on lines +377 to +382
let url = endpoint_url.resolve(ctx)?;
if url.is_empty() {
None
} else {
Some(url)
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correctness: endpoint_url is resolved and passed as Some(url) even if the resolved string is empty, which may cause downstream consumers to receive an invalid endpoint.

🤖 AI Agent Prompt for Cursor/Windsurf

📋 Copy this prompt to your AI coding assistant (Cursor, Windsurf, etc.) to get help fixing this issue

In engine/baml-lib/llm-client/src/clients/aws_bedrock.rs, lines 377-382, the code currently checks if the resolved endpoint_url is empty using `is_empty()`, but this will not catch strings that are only whitespace. Update the check to use `url.trim().is_empty()` to ensure that whitespace-only endpoint URLs are also treated as None.
📝 Committable Code Suggestion

‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
let url = endpoint_url.resolve(ctx)?;
if url.is_empty() {
None
} else {
Some(url)
}
let url = endpoint_url.resolve(ctx)?;
if url.trim().is_empty() {
None
} else {
Some(url)
}

Comment on lines +607 to +609
if let Some(endpoint_url) = self.properties.endpoint_url.as_ref() {
bedrock_config = bedrock_config.endpoint_url(endpoint_url);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correctness: bedrock_config.endpoint_url(endpoint_url) does not validate that endpoint_url is a valid URL, so passing an invalid value may cause runtime errors or panics when building the client.

🤖 AI Agent Prompt for Cursor/Windsurf

📋 Copy this prompt to your AI coding assistant (Cursor, Windsurf, etc.) to get help fixing this issue

In engine/baml-runtime/src/internal/llm_client/primitive/aws/aws_client.rs, lines 607-609, the code sets the endpoint_url for the Bedrock client without validating that the provided string is a valid URL. This can cause runtime panics or errors if an invalid URL is passed. Please update this block to parse and validate the endpoint_url using http::Uri::parse, and return an error if the URL is invalid, before setting it on the config builder.
📝 Committable Code Suggestion

‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
if let Some(endpoint_url) = self.properties.endpoint_url.as_ref() {
bedrock_config = bedrock_config.endpoint_url(endpoint_url);
}
if let Some(endpoint_url) = self.properties.endpoint_url.as_ref() {
if let Err(e) = endpoint_url.parse::<http::Uri>() {
return Err(anyhow::anyhow!("Invalid endpoint_url: {}", e));
}
bedrock_config = bedrock_config.endpoint_url(endpoint_url);
}

@roeybc roeybc had a problem deploying to boundary-tools-dev October 2, 2025 18:21 — with GitHub Actions Failure
@roeybc roeybc had a problem deploying to boundary-tools-dev October 2, 2025 18:21 — with GitHub Actions Failure
@roeybc roeybc had a problem deploying to boundary-tools-dev October 2, 2025 18:21 — with GitHub Actions Failure
Copy link

codecov bot commented Oct 2, 2025

Codecov Report

❌ Patch coverage is 0% with 28 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ine/baml-lib/llm-client/src/clients/aws_bedrock.rs 0.00% 23 Missing ⚠️
...rc/internal/llm_client/primitive/aws/aws_client.rs 0.00% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

@roeybc roeybc had a problem deploying to boundary-tools-dev October 9, 2025 01:28 — with GitHub Actions Failure
@roeybc roeybc had a problem deploying to boundary-tools-dev October 9, 2025 01:28 — with GitHub Actions Failure
@roeybc roeybc had a problem deploying to boundary-tools-dev October 9, 2025 01:28 — with GitHub Actions Failure
@sxlijin sxlijin changed the title added endpoint_url to amazon bedrock feat: added endpoint_url to amazon bedrock Oct 9, 2025
@sxlijin
Copy link
Collaborator

sxlijin commented Oct 9, 2025

Ugh, my github setup is being stupid... I'm having trouble pushing https://github.com/BoundaryML/baml/commits/feature/endpoint_url_amazon_bedrock/ into your branch.

I have to run right now, but if you merge the integ-test changes I can merge this tomorrow! If you don't I'll still try tomorrow, just not sure why my github auth is being wonky.

Signed-off-by: Roey Ben Chaim <roey.benhaim@gmail.com>
@roeybc
Copy link
Contributor Author

roeybc commented Oct 9, 2025

Done :D

@roeybc roeybc had a problem deploying to boundary-tools-dev October 9, 2025 16:47 — with GitHub Actions Failure
@roeybc roeybc had a problem deploying to boundary-tools-dev October 9, 2025 16:47 — with GitHub Actions Failure
@roeybc roeybc had a problem deploying to boundary-tools-dev October 9, 2025 16:47 — with GitHub Actions Failure
@sxlijin sxlijin enabled auto-merge October 9, 2025 16:47
@sxlijin sxlijin had a problem deploying to boundary-tools-dev October 9, 2025 20:00 — with GitHub Actions Failure
@sxlijin sxlijin had a problem deploying to boundary-tools-dev October 9, 2025 20:00 — with GitHub Actions Failure
@sxlijin sxlijin had a problem deploying to boundary-tools-dev October 9, 2025 20:00 — with GitHub Actions Failure
@sxlijin sxlijin had a problem deploying to boundary-tools-dev October 9, 2025 20:02 — with GitHub Actions Failure
@sxlijin sxlijin had a problem deploying to boundary-tools-dev October 9, 2025 20:02 — with GitHub Actions Failure
@sxlijin sxlijin had a problem deploying to boundary-tools-dev October 9, 2025 20:02 — with GitHub Actions Failure
@sxlijin sxlijin had a problem deploying to boundary-tools-dev October 10, 2025 18:23 — with GitHub Actions Failure
@sxlijin sxlijin had a problem deploying to boundary-tools-dev October 10, 2025 18:23 — with GitHub Actions Failure
@sxlijin sxlijin had a problem deploying to boundary-tools-dev October 10, 2025 18:23 — with GitHub Actions Failure
@sxlijin sxlijin added this pull request to the merge queue Oct 10, 2025
Merged via the queue into BoundaryML:canary with commit 10fd013 Oct 10, 2025
16 of 20 checks passed
AntennaeVY pushed a commit to AntennaeVY/baml that referenced this pull request Oct 16, 2025
Added support to endpoint_url when calling amazon bedrock. This is
needed to support private endpoints behind VPCs on aws.

---------

Signed-off-by: Roey Ben Chaim <roey.benhaim@gmail.com>
Co-authored-by: Sam Lijin <sam@boundaryml.com>
AntennaeVY pushed a commit to AntennaeVY/baml that referenced this pull request Oct 16, 2025
Added support to endpoint_url when calling amazon bedrock. This is
needed to support private endpoints behind VPCs on aws.

---------

Signed-off-by: Roey Ben Chaim <roey.benhaim@gmail.com>
Co-authored-by: Sam Lijin <sam@boundaryml.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants