From e53d299acf922395acf7b7b99a9a0230580dd4d9 Mon Sep 17 00:00:00 2001 From: mlopezr Date: Wed, 23 Apr 2025 15:36:50 +0200 Subject: [PATCH] Allow Amazon Bedrock Marketplace ARNs (#2874) * Update validate.ts Allow ARNs from Bedrock Marketplace, which are different because models are deployed using SageMaker Inference behind the scenes. * Update bedrock.ts Allow ARNs from Bedrock Marketplace, which are different because models are deployed using SageMaker Inference behind the scenes. --- src/api/providers/bedrock.ts | 2 +- webview-ui/src/utils/validate.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/providers/bedrock.ts b/src/api/providers/bedrock.ts index c2da82d4ac..116e2822dd 100644 --- a/src/api/providers/bedrock.ts +++ b/src/api/providers/bedrock.ts @@ -532,7 +532,7 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH * match[4] - The resource ID (e.g., "anthropic.claude-3-sonnet-20240229-v1:0") */ - const arnRegex = /^arn:aws:bedrock:([^:]+):([^:]*):(?:([^\/]+)\/([\w\.\-:]+)|([^\/]+))$/ + const arnRegex = /^arn:aws:(?:bedrock|sagemaker):([^:]+):([^:]*):(?:([^\/]+)\/([\w\.\-:]+)|([^\/]+))$/ let match = arn.match(arnRegex) if (match && match[1] && match[3] && match[4]) { diff --git a/webview-ui/src/utils/validate.ts b/webview-ui/src/utils/validate.ts index 82fda92626..439839a347 100644 --- a/webview-ui/src/utils/validate.ts +++ b/webview-ui/src/utils/validate.ts @@ -89,7 +89,7 @@ export function validateApiConfiguration(apiConfiguration?: ApiConfiguration): s */ export function validateBedrockArn(arn: string, region?: string) { // Validate ARN format - const arnRegex = /^arn:aws:bedrock:([^:]+):([^:]*):(?:([^/]+)\/([\w.\-:]+)|([^/]+))$/ + const arnRegex = /^arn:aws:(?:bedrock|sagemaker):([^:]+):([^:]*):(?:([^/]+)\/([\w.\-:]+)|([^/]+))$/ const match = arn.match(arnRegex) if (!match) {