Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bedrock: Agent CR Lambda provider errors not surfaced #402

Closed
1 task done
mccauleyp opened this issue Apr 23, 2024 · 3 comments
Closed
1 task done

bedrock: Agent CR Lambda provider errors not surfaced #402

mccauleyp opened this issue Apr 23, 2024 · 3 comments
Labels
bug Something isn't working needs-triage This issue or PR still needs to be triaged.

Comments

@mccauleyp
Copy link

mccauleyp commented Apr 23, 2024

Describe the bug

Errors in the Custom Resource Lambda provider function for Bedrock agents don't seem to get surfaced properly at the CDK console, I think because a Future is being embedded into the error message instead of the result of the future.

For example, if I try to create an agent with a model that isn't yet one of the static members:

AGENT_MODEL = bedrock.BedrockFoundationModel(
    "anthropic.claude-sonnet-v2:1", supports_agents=True,
)

I see the following deployment error:
❌ Deployment failed: Error: The stack named ______ failed to deploy: UPDATE_ROLLBACK_COMPLETE: Received response status [FAILED] from custom resource. Message returned: Error: RetryError[<Future at 0x7f5b68612840 state=finished raised AWSRetryableError>]

Expected Behavior

If I go to the AWS console and look at the CR Lambda log, I can find the error I'm looking for:

Screenshot 2024-04-23 at 3 18 53 PM

It looks like the final error handling logic is embedding the Future object into the message instead of the result, and we should be seeing the informative message Foundation model is null or not supported, try providing [anthropic.claude-v1, anthropic.claude-v2, anthropic.claude-instant-v1, anthropic.claude-v2:1, amazon.titan-text-premier-v1:0, anthropic.claude-3-sonnet-20240229-v1:0, anthropic.claude-3-haiku-20240307-v1:0] at the CDK console instead.

Current Behavior

Error cause is hidden, Future object is printed in message instead of error message.

Reproduction Steps

Try deploying an Agent with an unsupported model, e.g.:

AGENT_MODEL = bedrock.BedrockFoundationModel(
    "anthropic.claude-sonnet-v2:1", supports_agents=True,
)

I also saw the same thing happen when the model instruction was too many characters.

Possible Solution

The error message is showing RetryError[<Future at 0x7f5b68612840 state=finished raised AWSRetryableError>], so it seems like the result of the Future object needs to be put into the message instead of the object itself (e.g. future.result() instead of future).

Additional Information/Context

No response

CDK CLI Version

2.138.0

Framework Version

cdklabs.generative-ai-cdk-constructs==0.1.124

Node.js Version

v20.11.0

OS

OSX

Language

Python

Language Version

Python 3.11

Region experiencing the issue

us-east-1

Code modification

No

Other information

No response

Service quota

  • I have reviewed the service quotas for this construct
@mccauleyp mccauleyp added bug Something isn't working needs-triage This issue or PR still needs to be triaged. labels Apr 23, 2024
@krokoko
Copy link
Collaborator

krokoko commented Apr 24, 2024

Hi @mccauleyp , thank you for reporting this issue ! I was able to reproduce and will update here when we have an update.

@krokoko
Copy link
Collaborator

krokoko commented May 7, 2024

We are working on removing custom resources to use the official L1 constructs for Bedrock, this should fix this issue

@krokoko
Copy link
Collaborator

krokoko commented May 15, 2024

Closing this as #414 was merged and removes custom resources for bedrock

@krokoko krokoko closed this as completed May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage This issue or PR still needs to be triaged.
Development

No branches or pull requests

2 participants